Anonymous function shorthand

#(...)

is shorthand for

(fn [arg1 arg2 ...] (...))

(where the number of argN depends on how many %N you have in the body). So when you write:

#(%)

it’s translated to:

(fn [arg1] (arg1))

Notice that this is different from your first anonymous function, which is like:

(fn [arg1] arg1)

Your version returns arg1 as a value, the version that comes from expanding the shorthand tries to call it as a function. You get an error because a string is not a valid function.

Since the shorthand supplies a set of parentheses around the body, it can only be used to execute a single function call or special form.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)