Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
emidln
on May 5, 2014
|
parent
|
context
|
favorite
| on:
Why I am excited about Clojure
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).
ufo
on May 5, 2014
[–]
Also, in your example, the recursive call is not in tail position. You would first need to rewrite it to use an acumulator parameter.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
i.e.
Note, this isn't run under TCO (see loop/recur).