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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -