Hadi Elmougy Hadi Elmougy - 5 months ago 43
Scala Question

partition an Array with offset

in Clojure I can partition a vector with offset step like

(partition 2 1 [1 2 3 4])

this returns a sequence of lists of n items each at offsets step apart.
for example the previous method returns

((1 2) (2 3) (3 4))

I just wonder how can I acheive the same in Scala


I think this does what you need: