Created
June 9, 2016 17:45
-
-
Save MichaelQQ/4c1c86078048f1494925ef3e14539f52 to your computer and use it in GitHub Desktop.
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 makeMemoFib = (f, m = {}) => { | |
return (n) => { | |
if (m[n]) { | |
return m[n] | |
} | |
m[n] = f(makeMemoFib(f, m))(n); | |
return m[n]; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment