-
-
Save dimitris-papadimitriou-chr/9e131aa440016ec53e160e85be07d4cb 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
var node = (left, v, right) => ({ | |
left: left, | |
v: v, | |
right: right, | |
map: f => node(left.map(f), f(v), right.map(f)), | |
}); | |
var leaf = v => ({ v: v, map: f => leaf(f(v)), }); | |
var tree = node(leaf(1),3, node(leaf(5), 7, leaf(13))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment