Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>@khinsen and @mikera answered the question so well that it's hardly to make any additional comments yet I think they missed one point (or I couldn't find it in their comments).</p> <p>In Clojure macros are a part of the language. Use them or not, but they are there. In fact, you will often have no choice but use them since they make your applications more idiomatic (that's a feature of professional use of any language). They let you preprocess data structures that make up the application. They are akin to other language constructs in the sense they are included regardless of your needs.</p> <p>Unlike macros, monads are not a part of Clojure. They are built using the language's constructs, namely macros. They are not included at runtime unless you insist on them being there. To me monads are design patterns for composing computations, and therefore they're akin to other design patterns you may be familiar with. You use design patterns to develop modular and cohesive applications and be it monads or macros or any other language construct you should know they exists and work with them for your good.</p> <p>As to your question, macros work before monads ever kick in. Macros work at compilation phase - they change data structures to other data structures. Monads are a design pattern to compose computations. That's the difference. In Clojure, monads are written using macros (to make their use easier), and therefore people tend to say what you can do with monads you could easily achieve with macros. That's true as it comes out of monads design in Clojure, but the same might be said about macros themselves. You don't need to write new ones most of the time, and <a href="https://stackoverflow.com/questions/989374/help-me-write-a-clojure-macro-which-automatically-adds-metadata-to-a-function-de">the first rule of the macro club is to not write them</a> at all, but still they're a part of the language and you should be very well aware of their applications.</p> <p>See <a href="https://stackoverflow.com/questions/7593931/how-do-clojure-programmers-use-macros">How do Clojure programmers use Macros?</a> for more discussion about macros.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload