Christopher Tauss schrieb:

> I am a professional programmer with 11 years experience, yet I just do
> not seem to be able to get the hang of even simple things in Haskell.  I
> am trying to write a function that takes a list and returns the last n
> elements.

Looking through the glasses of lazy evaluation, I would use my
utility-ht:Data.List.Match module and write

lastn n xs = ListMatch.drop (drop n xs) xs

(ListMatch.drop ls xs) drops as many elements from xs as are in ls in
the most lazy way.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to