intern ( obj hash-set -- obj' )


Vocabulary
hash-sets

Inputs
objan object
hash-seta hash-set


Outputs
obj'a previously retained or the original object


Word description
If a value equal to obj is present in the hash-set, return the copy from the set, otherwise add obj to the hash-set and return the original. When used with strings, this word can be used to implement string interning, see https://en.wikipedia.org/wiki/String_interning.

Side effects
Modifies hash-set

See also
cache

Definition