The gensym library implements predicates for generating unique atoms. The public predicates are declared synchronized to prevent race conditions when using a backend Prolog compiler with multi-threading support.

API documentation

Open the ../../docs/library_index.html#gensym link in a web browser.


To load all entities in this library, load the loader.lgt file:

| ?- logtalk_load(gensym(loader)).


To test this library predicates, load the tester.lgt file:

| ?- logtalk_load(gensym(tester)).


The gensym_core category implements the library predicates. This category is imported by the default gensym object to provide application global generators. To make the generators local and thus minimize the potential for generator name clashes, the category can be imported by one of more application objects. Use protected or private import to restrict the scope of the library predicates. For example:

:- object(foo,

    bar :-
        ^^gensym(p, S),

:- end_object.