Hacker News new | ask | show | jobs
by emidln 4427 days ago
Named anonymous functions are there to allow you to call the function recursively while inside it.

i.e.

    (= ((fn factorial [x] 
          (if (<= x 1) 
              1 
              (* x (factorial (dec x))))) 5)
     120)
Note, this isn't run under TCO (see loop/recur).
1 comments

Also, in your example, the recursive call is not in tail position. You would first need to rewrite it to use an acumulator parameter.