Does Scala have a version of Rubys’ each_slice from the Array class?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Scala 2.8 has
groupedthat will chunk the data in blocks of sizen(which can be used to achieveeach_slicefunctionality):There isn’t anything that will work out of the box in 2.7.x as far as I recall, but it’s pretty easy to build up from
take(n)anddrop(n)fromRandomAccessSeq: