2013-09-17

Anonymous (lambda) functions in Clojure

I am learning a bit of Clojure from time to time, and today I learned about shorthand notation for anonymous functions:
> (apply (fn [x y] (+ x y)) '(1 1))
2
Which is equivalent to:
> (apply #(+ %1 %2) '(1 1))
2

No comments:

Post a Comment