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
| // Paul's clean-up | |
| function deDupe(dupeCheck, list) { | |
| return list.reduce(function (prev, curr) { | |
| if (!dupeCheck(curr, prev)) { | |
| prev.push(curr); | |
| } | |
| return prev; | |
| }, []); | |
| } |
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
| function recur(fn) { | |
| return function () { | |
| var bounce = fn.apply(this, arguments); | |
| while (bounce.onTheTrampoline) { | |
| bounce = bounce(); | |
| } | |
| return bounce; | |
| }; | |
| } | |
| var sum1 = recur(function sum(x, y) { |
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
| // clean and pure: | |
| function cons(x, y) { | |
| return function(pick) { | |
| return pick(x, y); | |
| } | |
| } | |
| // does more stuff: | |
| function cons(x, y) { | |
| var fn = function(pick) { |
NewerOlder