adjoin ( elt set -- )
Factor handbook > The language > Collections > Sets > Operations on sets

Prev:cardinality ( set -- n )
Next:delete ( elt set -- )


Vocabulary
sets

Inputs and outputs
eltan object
seta set


Word description
Destructively adds elt to set. For sequences, this guarantees that this element is not duplicated, and that it is at the end of the sequence.

Each mutable set type is expected to implement a method on this generic word.

Examples
USING: prettyprint sets kernel ; V{ "beans" "salsa" "cheese" } clone "nachos" over adjoin "salsa" over adjoin .
V{ "beans" "cheese" "nachos" "salsa" }


Side effects
Modifies set

Definition

GENERIC: adjoin ( elt set -- )


Methods