[Haskell-beginners] Haskell equivalent to Clojure's partition fn

Dan Serban dserban01 at gmail.com
Sat Jul 25 17:56:17 UTC 2015


It looks like chunksOf will take you most of the way there. Here's my
quick and dirty GHCi session output:

λ> import Data.List.Split
λ>
λ> let clojurePartition n m = map (take n) $ chunksOf (n+m) [0..]
λ>
λ> take 3 $ clojurePartition 4 6
[[0,1,2,3],[10,11,12,13],[20,21,22,23]]


More information about the Beginners mailing list