PLOGHELP GENSYM Jonathan Laventhol, 6 September 1983 Revised by Kathryn Seifert September 1986 Library program for generating new atoms Keywords: atom, symbol generation The library program GENSYM provides a facility to construct new atoms. To load the program, type: ?- library(gensym). You will now be able to make new words on demand: ?- gensym(foo, X). X = foo1 ?  ?- gensym(foo, Y). Y = foo2 ?  yes will give you the atom "foo1" the first time it is called, "foo2" the second time, and so on. You can use any word in place of "foo", and you can have any number of them at the same time. Each root word leaves an entry in the database like this: current_num(foo, 4) this means that the last word generated from "foo" was "foo4". If the entry is missing, it behaves as though there was an entry current_num(foo, 0). Thus you can control the next number if you want to, by retracting the 'current_num' entries for some atoms. For example, to make the next word for "foo" to be "foo100", do ?- retractall(current_num(foo, _)), /* always succeeds */ asserta(current_num(foo, 99)). See SHOWLIB * GENSYM for more information. -- RELATED DOCUMENTATION ---------------------------------------------- PLOGHELP * RETRACT Predicate which removes a specified clause from the database PLOGHELP * RETRACTALL Predicate which removes all clauses with a specified head PLOGHELP * ASSERT Predicate which adds a clause to the database HELP * GENSYM POP-11 procedure to generate new POP-11 words