3 ms·
This is what I gathered from the context of the article: Clojure is imperative in the sense that the code is evaluated and executed sequentially. For example,
by lynndylanhurley 12y ago
This is what I gathered from the context of the article:
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.
- MonkeyIsNull 12y agoYou can reference a function before it's defined, just as he did in the C example: http://clojuredocs.org/clojure_core/clojure.core/declare http://clojuredocs.org/clojure_core/clojure.core/declare
- ericn 12y agoThat'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 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/informal-semantics.html 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.