counter ( variable -- n ) (original) (raw)
Vocabulary
namespaces
Inputs
variable | a variable, by convention a symbol |
---|
Outputs
n | an integer |
---|
Word description
Increments the value of the variable by 1, and returns its new value.
Notes
This word is useful for generating (somewhat) unique identifiers. For example, the gensym word uses it.
Side effects
Modifies variable
Definition
: counter ( variable -- n ) [ 0 or 1 + dup ] change-global ;
inline