When you use #(...) , you can imagine what you write (fn [args] (...)) , including the brackets that you started immediately after the pound.
So your non-working example is converted to:
((fn [s] (s)) "Eh")
which obviously does not work because you are trying to call the string "Eh". Your example with str works, because now your function is (str s) instead of (s) . (identity s) will be a closer analogue to your first example, since it will not force str.
This makes sense if you think about it, because besides this absolutely minimal example, every anonymous function is going to call something, so it would be foolish to require another set of partners to actually call.
John Flatness Nov 03 2018-12-12T00: 00Z
source share