Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simonrichardson/bounces
Implementation of a trampoline
https://github.com/simonrichardson/bounces
Last synced: 22 days ago
JSON representation
Implementation of a trampoline
- Host: GitHub
- URL: https://github.com/simonrichardson/bounces
- Owner: SimonRichardson
- Created: 2013-11-26T09:20:15.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-26T09:50:24.000Z (almost 11 years ago)
- Last Synced: 2024-05-01T23:21:22.110Z (6 months ago)
- Language: JavaScript
- Size: 102 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Trampoline
Reifies continutations onto the heap, rather than the stack. Allows
efficient tail calls.Example usage:
```javascript
function loop(n) {
function inner(i) {
if(i == n) return done(n);
return cont(function() {
return inner(i + 1);
});
}return trampoline(inner(0));
}
```Where `loop` is the identity function for positive numbers. Without
trampolining, this function would take `n` stack frames.