
19 Feb
2012
19 Feb
'12
1:27 p.m.
Am 19.02.2012 19:00, schrieb bahadýr altan:
myremove x s = (take (s-1) x):(drop (s+1) x)
take :: Int -> [a] -> [a] drop:: Int -> [a] -> [a] Both functions return a list, therefore you need the "++" operator to append two lists: (++): [a] -> [a] -> [a] So this is what you get: (I changed s and x becausee I associate s with a string and x with a number) myremove :: String -> Int -> String myremove s x = (take (x-1) s) ++ (drop (x) s) Notice that you have to drop x elements (and not x+1). http://hackage.haskell.org/packages/archive/base/latest/doc/html/Prelude.htm...