I am just learning the language and I've got a simple question. Why does this work (constructs {:key "value"}):
(#(assoc {} :key %) "value")
But this doesn't:
(#({:key %}) "value")
ArityException Wrong number of args (0) passed to: PersistentArrayMap clojure.lang.AFn.throwArity (AFn.java:429)
On Python the latter syntax is perfectly valid:
> (lambda v: {'key': v})('value')
{'key': 'value'}
edit: thanks for great answers, it is apparent I need to stop thinking # as equivalent to lambda in Python.
#(f x) == (fn [] (f x)) :. #({x}) == (fn [] ({x}))#(-> {:key %})#(hash-map :k %)