clojure - returning a data type from a fn literal -
the below expression works -
((fn[n][(take n (range))]) 10)
while below throws error -
(#([(take % (range))]) 10)
why cant return data type function literal ?
if absolutely want return "data" anonymous function using #
reader macro use do
.
#(do [1 2])
as @mars said have alternative use vector
function.
#(vector 1 2)
Comments
Post a Comment