The Story of ALTER

Carl Sassenrath, CTO
REBOL Technologies
4-Apr-2008 0:02 GMT

Article #0124
Main page || Index || Prior Article [0123] || Next Article [0125] || 11 Comments || Send feedback

Alter is a mezzanine function that is a shortcut for alternating between insert and remove of a value.

Alter looks to see if a specified value is already part of a collection (in block). If not, it adds it. Otherwise, it removes it.

Here is an example:

>> flags: []

>> alter flags 'resize
>> flags
== [resize]

>> alter flags 'maximize
>> flags
== [resize maximize]

>> alter flags 'resize
>> flags
== [maximize]

Alter came about during the creation of VID(2), where we wanted to add or remove flag values from various blocks of flags.

Some users have suggested that the function is not worthwhile and should be removed from REBOL.

Should it be removed?


Updated 26-May-2024 - Edit - Copyright REBOL Technologies -