Proposal (Trac ticket #3671): Add takeRec, genericTakeRec and spanRec to Data.List

Malcolm Wallace malcolm.wallace at
Wed Nov 18 20:15:17 EST 2009

> groupsOf n = takeWhile (not . null) . map (take n) . iterate (drop n)

+1 for the name.  Nice combinator-based definition too.  (How does its  
performance compare to a directly recursive defn??)


More information about the Libraries mailing list