λ> :t Nil Nil :: List a λ> :t Cons Cons :: a -> List a -> List a λ> :k List List :: * -> * λ> :t [] [] :: [a] λ> :t (:) (:) :: a -> [a] -> [a] λ> :k [] [] :: * -> * λ> foldrBinTree (+) 0 t *** Exception: /home/trifon/fmisync/Courses/2021_22/FP_2021_22/sandbox/lectures/haskell/Data.hs:168:1-81: Non-exhaustive patterns in function foldrBinTree λ> foldrBinTree (+) 0 t 9 λ> tree Tree {rootTree = 1, subtrees = SubTree {firstTree = Tree {rootTree = 2, subtrees = None}, restTrees = SubTree {firstTree = Tree {rootTree = 3, subtrees = SubTree {firstTree = Tree {rootTree = 4, subtrees = None}, restTrees = None}}, restTrees = SubTree {firstTree = Tree {rootTree = 5, subtrees = None}, restTrees = None}}}} λ> :t map map :: (a -> b) -> [a] -> [b] λ> level 0 tree [1] λ> level 1 tree [2,3,5] λ> level 2 tree [4] λ> level 10 tree [] λ> sexpr SList {list = [SInt 2,SChar 'a',SList {list = [SBool True,SDouble 1.2,SList {list = []}]}]} λ> countAtoms sexpr 4 λ> countAtoms sexpr 4 λ> :t list list :: SExpr -> [SExpr] λ> flatten sexpr SList {list = [SInt 2,SChar 'a',SBool True,SDouble 1.2]} λ> flatten sexpr SList {list = [SList {list = [SInt 2]},SList {list = [SChar 'a']},SList {list = [SList {list = [SBool True]},SList {list = [SDouble 1.2]},SList {list = []}]}]} λ> sexpr SList {list = [SInt 2,SChar 'a',SList {list = [SBool True,SDouble 1.2,SList {list = []}]}]} λ> :t concatMap concatMap :: Foldable t => (a -> [b]) -> t a -> [b] λ> flatten sexpr SList {list = [SInt 2,SChar 'a',SBool True,SDouble 1.2]}