recursion - Non tail-recursive anonymous functions in Clojure -


how create recursive anonymous function in clojure not tail recursive?

the following doesn't work, recur tail recursive functions. i'm reluctant drag in y-combinator..

((fn [n] (if (= 1 n) 1 (* n (recur (dec n))))) 5) 

functions can given name refer specifying between fn , arglist:

user> ((fn ! [n] (if (= 1 n) 1 (* n (! (dec n))))) 5) 120 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -