Created
June 13, 2015 23:00
-
-
Save ashnur/3c291781d3e40ef9d557 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
var iter = (f) => (x) => [x, () => iter(f)(f(x))] | |
var map = (f) => (a) => [f(a[0]), () => map(f)(a[1]())] | |
var takeWhile = (f) => (a) => f(a[0])? [a[0]].concat(takeWhile(f)(a[1]())) : [] | |
var x = 100 | |
var xs = iter(a=>~~(a/2))(x) | |
var ys = map(a=>x-a)(xs); | |
takeWhile(a=>a<x)([0,()=>ys]) |
Author
ashnur
commented
Jun 15, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment