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

marcel.taeumel Marcel.Taeumel at hpi.de
Thu Sep 3 11:30:42 UTC 2015


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.


More information about the Squeak-dev mailing list