This file contains hidden or 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); } | |
}); |
This file contains hidden or 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 Loop = (fn, ... init) => { | |
let r = fn (... init) | |
while (r instanceof Recur) r = fn (... r) | |
return r | |
} | |
const Recur = ( ...v) => Object .create ( | |
Recur .prototype, | |
{[Symbol .iterator]: {value: _ => v .values ()}} | |
) |
This file contains hidden or 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
# recurly does not document using cURL to access their API, they really want you to use their libraries. | |
# Sometimes i need to test something quick. I do not want to write a script importing your stupid library. | |
# So here's how you do it: | |
APIKEY=<get your API key from your recurly.com site> | |
curl -H "Accept: application/vnd.recurly.v2021-02-25+json" -u $APIKEY: https://v3.recurly.com/accounts |
OlderNewer