Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A2)a)
- mapList :: (Int -> Int) -> List -> List
- mapList _ [] = []
- mapList f (x:xs) = f x : maplist f xs
- b)
- negateList :: List -> List
- neagteList xs = mapList (\x -> -x) x:xs
- c)
- foldList :: (Int -> a -> a) -> a -> List -> a
- foldList f c Nil = c
- foldList f c Cons( a n) = f a (foldList f c n)
Advertisement
Add Comment
Please, Sign In to add comment