|
|
|
|
|
by happy4crazy
4911 days ago
|
|
We don't address this in the post, but adding :while conditions is quite a fun challenge. This is the best I could come up with (in Emacs Lisp): https://gist.github.com/4356261 . It's rather hacky :D Darius Bacon (abecedarius) came up with a beautiful alternative formulation that handles :while conditions seamlessly. Here's my port of his idea into Emacs Lisp: https://gist.github.com/4380866 I'd be very happy to see other versions :) |
|
Eurgh, I hate the common Clojure habit (you see it in for, doseq, etc. loops, and in domonad, which is annoying in other ways) of abusing binding vectors to add in extra stuff that doesn't, in itself, have anything to do with binding names to values.
If you use a very slightly modified version of the macro defined at [1] (modified to use algo.monads), you can do list comprehensions like this:
The "let added = (+ x y)" is an unnecessary flourish: it would have worked just as well to wrap what followed in (let [added (+ x y)] ...). Likewise (as against domonad), you can just use regular old if; no need for :if.1: https://bitbucket.org/kenko/macroparser/src/7a492ef941db38db...