reversed and ofSize:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

reversed and ofSize:

stes

Hi,

OrderedCollection, or its parent, SequencableCollection in Squeak 4.6 has

Reply | Threaded
Open this post in threaded view
|

Re: reversed and ofSize:

stes

reversed
        "Answer a copy of the receiver with element order reversed."
        "Example: 'frog' reversed"

        | n result src |
        n := self size.
        result := self species ofSize: n.
        src := n + 1.
        1 to: n do: [:i | result at: i put: (self at: (src := src - 1))].
        ^ result

However this method is absent in GNU Smalltalk.

It's perhaps a Squeak specific addition.

Is there any interest in adding ofSize: and reversed to the GNU Smalltalk kernel ?

----- Op 10 jan 2021 om 20:36 schreef stes [hidden email]:

> Hi,
>
> OrderedCollection, or its parent, SequencableCollection in Squeak 4.6 has