3 ms·
Actually in Clojure I tend to distinguish: Anonymous function: (fn [a] ... a) And lambda: #(... %) I don't think this is official nomenclature, but I've be
by didibus 6y ago
Actually in Clojure I tend to distinguish:
Anonymous function:
(fn [a] ... a)
And lambda:
#(... %)
I don't think this is official nomenclature, but I've been using that to distinguish between both syntaxes.
In truth though, anonymous functions is the more accurate terminology, because lambdas are actually not functions, they're supposed to curry and use term substitution. Where as most programming languages use anonymous functions, which support multi-arity and sometime even variadic arity, and don't use term substitution, but more common argument binding.
- fulafel 6y agoTrivia: You can name fns: (map (fn first-or-last [x] (or (first x) (last x)) my-seq) (Of course the name has no semantic effects as you can't refer to it from code, but it's there in debugging / stack traces and serves as a comment for the reader).
- didibus 6y agoActually you can refer to the name inside the anonymous function for self-recursion I believe.