[Haskell-cafe] Need help of explanation possible!!! Pls

iliali16 iliali16 at gmail.com
Fri Feb 23 23:40:44 EST 2007

Hi I am abit new to this language though I manage to study it very fast and
understand it well. I have some tutorials to do inorder to practice it. The
thing is I want to declear some functions but to do that I need to
understand how exactly "take" works in hugs. Couse I want to build a similar
function but I don't know how I will continue:

this is where I reach

take :: Integer -> [Integer] -> [Integer]
take _ [] = []
take n xs 
      |x < lenghtList xs = (take (n-1) xs :[])
      |otherwise = xs

I have decleared lenghtList before. I am not going to discuse lenght now
couse it is easy and not for the scope of what I need. I know that what I
did up there is completly wrong but that is what I came out while trying to
understand how would the interpreter read and implement this. If you have
any ideas how this function works please explain me I would be very
greatfull.I have to do a similar one but to do it I have to understand this
one. If u try it in hugs u will realise it is an allready decleared function
but what I need is to understand how it works.What it must do is to get a
num and a list and to display the elements of the list till the nth element
which is the number we have given.if the list is smaller in lenght then the
given num we return the whole list. Thanks in advance to all the folks who
do help me please :(( !
View this message in context: http://www.nabble.com/Need-help-of-explanation-possible%21%21%21-Pls-tf3282642.html#a9131026
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070223/aabfb77d/attachment.htm

More information about the Haskell-Cafe mailing list