Skip to content

Instantly share code, notes, and snippets.

@dimitris-papadimitriou-chr
Created July 21, 2020 17:55
Show Gist options
  • Save dimitris-papadimitriou-chr/e21e16e8c48212c6956f10ba1a1e8563 to your computer and use it in GitHub Desktop.
Save dimitris-papadimitriou-chr/e21e16e8c48212c6956f10ba1a1e8563 to your computer and use it in GitHub Desktop.
public static partial class FunctionalExt
{
public static Tree<T> Reverse<T>(this Tree<T> @this) =>
@this switch
{
Leaf<T> { Value: var v } => {...},
Node<T> { Left: var l, Value: var v, Right: var r } => {...},
_ => throw new NotImplementedException()
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment