Created
March 17, 2018 15:14
-
-
Save buzzdecafe/54e7f591e7023abc0c806409d27b5df7 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
const NIL = Symbol('~~NIL~~'); | |
const isNil = x => typeof x === 'symbol' && x.toString() === NIL.toString(); | |
const pair = (a, b) => ({ | |
fst: function* () { yield a; }, | |
snd: function* () { yield b; }, | |
[Symbol.iterator]: function* () { yield a; (b[Symbol.iterator] ? yield* b : yield b); } | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment