[Haskell-cafe] Hi can u explain me how drop works in Haskell
iliali16
iliali16 at gmail.com
Sun Feb 25 20:43:20 EST 2007
Hi I am trying to implement the function drop in haskell the thing is that I
I have been trying for some time and I came up with this code where I am
trying to do recursion:
drop :: Integer -> [Integer] -> [Integer]
drop 0 (x:xs) = (x:xs)
drop n (x:xs)
|n < lList (x:xs) = dropN (n-1) xs :
|otherwise = []
So I want to understand how would this work and what exacttly should I put
as an answer on line 4 couse that is where I am lost. I know I might got the
base case wrong as well but I don't know what to think for it. I have done
the lList as a function before writing this one. Thanks to those who can
help me understand this. Thanks alot in advance! Have a nice day!
--
View this message in context: http://www.nabble.com/Hi-can-u-explain-me-how-drop-works-in-Haskell-tf3290490.html#a9152251
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe
mailing list