Yes, but this is not possible, but you cannot embed forms-reader-macro #()
, you need to use form (fn)
.
For instance:
(#(
does not work, because there is no way to refer to the arguments of external anonymous functions. This reads as an external function that takes two arguments, and the internal function takes zero arguments.
But you can write the same with (fn...)
s:
user=> (((fn [x] (fn [y] (+ xy))) 1) 2) 3
You can also use the #()
form for one of two anonymous functions, for example:
user=> (
Thus, you can embed your div
function as follows (note that we had to change the form #()
passed to the map
form to the (fn)
form):
#(= true (= 0 (reduce + (map (fn [x] (mod % x)) (range 1 21)))))
source share