Created
August 18, 2015 19:04
-
-
Save wavebeem/7205858407f7d3770ba2 to your computer and use it in GitHub Desktop.
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
// squiggle> :set f = fn(n) match (n) { case 0 => 1 case x => x * f(x - 1) } | |
(function () { | |
'use strict'; | |
return (false || eval)('this')['f'] = sqgl$$freeze(function (n) { | |
if (arguments.length !== 1) { | |
throw new sqgl$$Error('expected 1 argument(s), got ' + arguments.length); | |
} | |
return function ($match) { | |
if (sqgl$$is($match, 0)) { | |
return function () { | |
return 1; | |
}(); | |
} | |
if (true) { | |
return function (x) { | |
return $star(x, f($minus(x, 1))); | |
}($match); | |
} | |
throw new sqgl$$Error('pattern match failure'); | |
}(n); | |
});; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment