On Oct 15, 2007, at 7:59 , Felipe Lessa wrote:

On 10/15/07, apfelmus <[EMAIL PROTECTED]> wrote:
   lasts :: Int -> [a] -> [a]
lasts n xs = head $ [x | (x,[]) <- zip (tails xs) (tails $ drop n xs)]
(...)
   main n = print . sum . map read . lasts n . lines =<< getContents

But that's a a two-liner now heh =).

.oO { if you want Perl, you know where to find it... }

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university    KF8NH


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

Reply via email to