A.18 library(gensym): Generate unique symbols
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(gensym): Generate unique symbols
          • gensym/2
          • reset_gensym/0
          • reset_gensym/1
    • Packages
Availability::- use_module(library(gensym)).(can be autoloaded)
Sourcegensym(+Base, -Unique)
Generate <Base>1, <Base>2, etc atoms on each subsequent call. Note that there is nothing that prevents other parts of the application to‘invent' the same identifier. The predicate gensym/2 is thread-safe in the sense that two threads generating identifiers from the same Base will never generate the same identifier.
See also
uuid/1, term_hash/2, variant_sha1/2 may be used to generate various unique or content-based identifiers safely.