Re:Clojure is imperative as opposed to declarative
by ericn on Saturday August 23, 2014 @05:05PM
(#8216862)
That's close to what I meant.
Closer would be:
Clojure def is imperative because the semantics are defined mechanically, leaving fewer implementation details up to the implementer. http://clojure.org/special_forms#Special Forms--(def symbol init?)
Haskell toplevel function definitions are more declarative because the semantics are defined less concretely. https://www.haskell.org/ghc/docs/latest/html/users_guide/inf...
This is what I meant. I did not mean to start a flame war about the definition of declarative. It's more about different approaches to language design.
Re:Clojure is imperative as opposed to declarative
by MonkeyIsNull on Saturday August 23, 2014 @04:55PM
(#8216843)
You can reference a function before it's defined, just as he did in the C example: http://clojuredocs.org/clojure_core/clojure.core/declare
Clojure is imperative in the sense that the code is evaluated and executed sequentially. For example, a function cannot be referenced before it is defined.
This is in contrast with (declarative) languages such as Haskell, in which the compiler will evaluate the entire file before executing any code.
Someone please correct me if I'm mistaken.