segment :: Int -> [a] -> [[a]]
segment 0 _ = []
segment _ [] = []
segment n x = (take n x) : segment n (drop n x)


I did a version of this which used splitAt but I wasn't sure whether it was going to buy me anything re performance that would justify its ugliness.


Michael






_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to