Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added exercise 7
  • Loading branch information
christian-fei committed Mar 4, 2015
1 parent dca7167 commit 7eec43e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions session2.hs
Expand Up @@ -10,6 +10,11 @@ myReverse = foldl (\acc x -> x:acc) []
isPalindrome :: (Eq a) => [a] -> Bool
isPalindrome xs = xs == reverse xs

data NestedList a = Elem a | List [NestedList a] deriving (Show)
flatten :: NestedList a -> [a]
flatten (Elem x) = [x]
flatten (List []) = []
flatten (List (x:xs)) = flatten x ++ flatten (List xs)

-- 8 compress

Expand Down

0 comments on commit 7eec43e

Please sign in to comment.