Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Inverse Tree function
def invertTree[A](tree: Tree[A]): Tree[A] =
fold (tree, Tree.empty[A]){(leftT, value, rightT) => Node(value, rightT, leftT)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment