I noticed in my code that I often nest a let inside an if-let, or vice-
versa, so I wrote a macro let-else that expands into nested lets,
except where there's an :else <expr> after a binding, in which case
that binding expands into an if-let.

E.g.

(let-else
  [foo (f1) :else (e)
   bar (f2)]
  (b1)
  (b2))

expands into

(if-let [foo (f1)]
  (let [bar (f2)]
    (b1)
    (b2))
  (e))

The jar is at https://clojars.org/org.clojars.egamble/let-else
The code is at https://github.com/egamble/let-else

- Evan

-- 
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

Reply via email to