Created
May 27, 2015 21:05
-
-
Save mrkaspa/c50a81c14f4a05c1b8fb to your computer and use it in GitHub Desktop.
Tail recursion con bilby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bilby = require('bilby') | |
loop1 = (n) -> | |
inner = (acc, i) -> | |
if(i is 0) | |
bilby.done(acc) | |
else | |
bilby.cont( -> | |
inner(acc + i, i - 1) | |
) | |
bilby.trampoline(inner(0, n)) | |
console.log loop1(25000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment