next up previous contents index
Next: 1.13 Random Number Generator Up: 1. Library Utilities Previous: 1.11.2 Low-level Trie Manipulation   Contents   Index

1.12 Gensym

The Gensym library provides a convenient way to generate unique integers or constants.

prepare(+Index)
gensym
Sets the initial integer to be used for generation to Index. Thus, the command ?- prepare(0) would cause the first call to gennum/1 to return 1. Index must be a non-negative integer.

gennum(-Var)
gensym
Unifies Var with a new integer.

gensym(+Atom,-Var)
gensym
Generates a new integer, and concatenates this integer with Atom, unifying the result with Var. For instance a call ?- gensym(foo,Var) might unify Var with foo32.



Terrance Swift 2007-10-06