Last active
February 17, 2019 23:02
-
-
Save eduardoleon/a470f931222eb0c77f6e3e992db1735a to your computer and use it in GitHub Desktop.
Binary trees are isomorphic to forests of rose trees
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
datatype bin = Leaf | Node of bin * bin | |
datatype rose = T of rose list | |
fun forth Leaf = nil | |
| forth (Node (a, b)) = T (forth a) :: forth b | |
fun back nil = Leaf | |
| back (T a :: b) = Node (back a, back b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment