chunk n list = case list of { [] -> [] ; (y:ys) -> ch' ys (n-1) (y:) } where
ch' [] _ k = k [] : []
ch' (y:ys) 0 k = k [] : ch' ys (n-1) (y:)
ch' (y:ys) (c+1) k = ch' ys c (k . (y:))
Showing posts with label Quest for Chunks. Show all posts
Showing posts with label Quest for Chunks. Show all posts
Tuesday, 27 May 2008
A Haskell Puzzle
Subscribe to:
Posts (Atom)