Just take an idea from Haskell (as usual!). Function 'flip' returns a
function taking its first two arguments in order opposite the given
function:

user> (defn flip [f] (fn [a2 a1 & more] (apply f a1 a2 more)))
#'user/flip
user> (- 10 2 3)
5
user> ((flip -) 2 10 3)
5
user> ((partial < 2000) 1000)
false
user> ((partial (flip <) 2000) 1000)
true

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