Skip to content

Instantly share code, notes, and snippets.

@adilakhter
Created June 24, 2015 10:47
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save adilakhter/bb7825ac2eff66c738a2 to your computer and use it in GitHub Desktop.
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