Why are Clojure's `let` and `for` both monads?
问题 In this discussion Brian Marick makes the point that let and for are monads in Clojure: That said, the really general-purpose monads tend to get written into the language as special forms. Clojure's let and for are both monads, but you don't need to know that to use them. This is let user=> (let [c (+ 1 2) [d e] [5 6]] (-> (+ d e) (- c))) 8 This is for user=> (for [x [0 1 2 3 4 5] :let [y (* x 3)] :when (even? y)] y) (0 6 12) My question is: Why are Clojure's let and for both monads? 回答1: Why