Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for example:
- the 'setElements' doesnt compile:
- my code:
- setElement :: Int -> a -> [a] -> [a]
- setElement n x xs = if ((n < length xs) && n >= 0)
- then (take n xs) ++ [x] ++ (drop (n + 1) xs)
- else xs
- setElements :: [(Int, a)] -> [a] -> [a]
- setElements = foldr (t l-> setElement (fst head t) (snd head t) l) []
- how can i fix the error?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement