Skip to content

Instantly share code, notes, and snippets.

@eduardoleon
Last active February 17, 2019 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eduardoleon/a470f931222eb0c77f6e3e992db1735a to your computer and use it in GitHub Desktop.
Save eduardoleon/a470f931222eb0c77f6e3e992db1735a to your computer and use it in GitHub Desktop.
Binary trees are isomorphic to forests of rose trees
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