I have an collection c, I basically want to split the collection into two parts: the first n items into one list and the rest to another. Obviously, I can use do:, but is there a better way to do it?
I don't know about the other dialects but pharo has this useful methods: first:
last:
allButFirst:
allButLast:
So you can do something like:
firstPart := c first: 10.
secondPart := c allButFirst: 10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With