Skip to content

Conversation

tatut
Copy link

@tatut tatut commented Dec 4, 2021

Add a partitionBy method and test.

Don't know if something similar or more idiomatic is available, but I didn't find it.

#(1 2 3 4 5 6) partitionBy: 2 >>> #(#(1 2) #(3 4) #(5 6))

@tatut
Copy link
Author

tatut commented Dec 7, 2021

Never mind, learned about groupsOf :D

@tatut tatut closed this Dec 7, 2021
@Ducasse
Copy link
Contributor

Ducasse commented Dec 7, 2021

Thanks for your will to improve Pharo. We are interested in other iterators :).
I learned that we have groupsOf: too!

@jecisc
Copy link
Member

jecisc commented Dec 8, 2021

There are also #pairsDo: and #pairsCollect: that might interest you.

@tatut tatut reopened this Dec 14, 2021
@tatut
Copy link
Author

tatut commented Dec 14, 2021

I would like to reintroduce this with a variant of the regular groupsOf:.

The groupsOf:step: will return successive groups and advance the start position by specified step after each.

@tatut tatut changed the title Add partitionBy method to SequenceableCollection extension. Add groupsOf:step: method to SequenceableCollection extension. Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants