
20 Sep
2010
20 Sep
'10
4:34 a.m.
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.