Created
December 2, 2021 01:15
-
-
Save chrilves/ab650b16da984e54cd48bf41c0ae1ca0 to your computer and use it in GitHub Desktop.
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
enum Weird<A> { | |
Leaf(A), | |
Node(Box<Weird<(u8,A)>>) | |
} | |
fn traversal<A>(weird: &Weird<A>) { | |
match weird { | |
Weird::Leaf(_) => | |
println!("Leaf"), | |
Weird::Node(b) => { | |
println!("Node"); | |
traversal::<(u8,A)>(b) | |
} | |
} | |
} | |
fn main() { | |
let w0: Weird<u8> = Weird::Leaf(0); | |
traversal(&w0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment