Created
January 18, 2021 21:48
-
-
Save evgenii-malov/555386ad33c5fb0bcbd429e3e35ba36e 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
| -- see video https://www.youtube.com/watch?v=j8r17UrWSyE&t=319s | |
| data Btree a = Leaf a | Node a (Btree a) (Btree a) deriving Show | |
| tr :: Btree Integer | |
| tr_l = Node 1 (Leaf 2) (Leaf 3) | |
| tr_r = Node 4 (Leaf 5) (Leaf 6) | |
| tr = Node 7 tr_l tr_r | |
| all_paths :: Btree a -> [[a]] | |
| all_paths (Leaf a) = [[a]] | |
| all_paths (Node a l r) = (a:) <$> (all_paths l)++(all_paths r) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see video