One of the issues i had and still have with the if function is that
because it has ordered arguments, makes things more complex.
For small functions this is no so much of a problem.
(if test 1 0)
But when things get larger, that extra complexity of order without
explicit information can get significant, I believe
So I wanted (this would be officially my first macro ever!) something that
behaved as follows:
(if test
:then true
:else false)
(if test
:else false
:then true)
Which is what I eventually did:
(defmacro iff
[test & body]
(let [args (apply hash-map body)]
`(if ~test (:then ~args) (:else ~args))))
Any thoughts, improvements on my macro? (Also I'm not quite sure how to
document my macro. So any advice on that is appreciated :)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en