Last active
January 13, 2017 19:10
-
-
Save erights/d318decf3813a2d7ca70ab8fe5bea2b3 to your computer and use it in GitHub Desktop.
microses-to-microses-for-persistence
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 makeAddr = (x => (y => x + y)); | |
const wm = makeWeakMap(); | |
const makeAddr = (x => { | |
const fn = (y => x + y); | |
wm.set(fn, {get x() { return x; }); | |
return fn; | |
}); | |
const add5 = makeAddr(5); | |
add5(3); // 8 | |
wm.get(add5).x; // 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment