Hello! I'm Working with Lists in Haskell, I�m a Beginner in Functional Programming and I would like to know if there is a way to write a more efficient function that return the length of a list, I wrote this one:

long        ::  [a]->Int
long p     =  longitud p 0
                   where
                   longitud []       s=s
                   longitud (x:xs) s=longitud xs (s+1)

but I think that it have a lineal grow O(n).

thanks!

 

 

 

 



Add photos to your e-mail with MSN 8. Get 3 months FREE*. _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

Reply via email to