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

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -