-- compute length of list listlen :: [a] -> Int listlen2 :: [a] -> Int -> Int listlen ( x:xs ) = listlen2 xs 1 listlen2 ( x:xs ) n = listlen2 xs (n + 1) listlen2 [] n = n myReverse (x:xs) = myReverse xs ++ [x] myReverse [] = [] makePalin x = x ++ myReverse x isPalin a = a == myReverse a -- in python: ",".join(["abc", "def"]) join :: String -> [String] -> String join sep (x:xs) | xs /= [] = x ++ sep ++ join sep xs join sep [x] = x -- a tree data Tree a = Node a (Tree a) (Tree a) | Empty deriving Show --height :: Tree -> Int height (Node _ left right) = max ((height left) + 1) ((height right) + 1) height Empty = 0