[squeak-dev] A beautiful idiom.
Stéphane Rollandin
lecteur at zogotounga.net
Wed Feb 12 00:26:43 UTC 2020
> This one is faster though (it uses the fact that the elements are
> already ordered):
>
> | nc |
> nc := self species new: self size.
> self ifEmpty: [^ nc].
> nc add: self first.
> self do: [:ea | nc last = ea ifFalse: [nc add: ea]].
> ^ nc
>
> Stef
Hmm... sorry for the noise. I confused "ordered" and "sorted"...
Stef
More information about the Squeak-dev
mailing list
|