[Haskell-cafe] Ultra-newbie Question
Henning Thielemann
schlepptop at henning-thielemann.de
Mon Sep 20 04:34:42 EDT 2010
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.
More information about the Haskell-Cafe
mailing list