[squeak-dev] #firstOrLess: and #lastOrLess: ?

karl ramberg karlramberg at gmail.com
Thu Sep 3 14:00:33 UTC 2015


The name firstOrLess: is a little confusing.
Maybe something like collectMax:


Karl

On Thu, Sep 3, 2015 at 1:30 PM, marcel.taeumel <Marcel.Taeumel at hpi.de>
wrote:

> Hi --
>
> Is there a better way to get a limited number of elements from a collection
> but accept less if the collection is not big enough?
>
> someObjects size >= 5
>   ifTrue: [someObjects first: 5]
>   ifFalse: [someObjects].
>
> Could we add a #firstOrLess:? Similar thoughts on #firstOrNil, #lastOrNil,
> and #lastOrLess:.
>
> Best,
> Marcel
>
>
>
> --
> View this message in context:
> http://forum.world.st/firstOrLess-and-lastOrLess-tp4847874.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20150903/9276fe5e/attachment-0001.htm


More information about the Squeak-dev mailing list