SHARE
TWEET

Untitled

a guest Jun 24th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for example:
  2.      
  3. the 'setElements' doesnt compile:
  4.  
  5. my code:
  6.      
  7. setElement :: Int -> a -> [a] -> [a]
  8. setElement n x xs = if ((n < length xs) && n >= 0)
  9.                     then (take n xs) ++ [x] ++ (drop (n + 1) xs)
  10.                     else xs
  11.  
  12. setElements :: [(Int, a)] -> [a] -> [a]
  13. setElements = foldr (t l-> setElement (fst head t) (snd head t) l) []
  14.      
  15. how can i fix the error?
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top