I’d like to call an anonymous function which is not using the shorthand notation from another anonymous function.
Doing the following isn’t working because the last evaluation is returned:
user> ((fn [x] (fn [y] (inc y)) x) 3)
3
Now I’d like to have a way to call the inside anonymous function from the outer one.
I managed to make it work by doing this but it looks complicated:
user> ((fn [x] (let [f (fn [y] (inc y))] (f x))) 3)
4 ;; good, 4 is the result I want here
Is there an easier way to nest anonymous functions?
Let’s break that first line up:
Note that the inner function is never used.
What you seem to want to do: