> How to rearrange the Clojure code for understandability? One approach I've used in Common Lisp to avoid multiple lets is to do
(let* ((x (let ((v 1)) (f v) ; for side-effects v)) (y (+ x 2))) (g y)) This calls to mind Clojure's doto, which instantiates a Java object, does some stuff to it, then returns the object. It would be easy to define a macro to describe this. Of course, if `f` *returns* the value you want to bind to `x`, you don't have this problem (you can just put (f x) directly in the let binding form). You also don't have this problem if you don't need to call `f` before binding `y`. (+ x 2) is side-effect free, and (f x) cannot mutate `x`, so your Clojure code can easily be written (let [x 1 y (+ x 2)] (f x) (g y)) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en