Skip to content

clojure.core/gensym

View this page on ClojureDocs

Type: function Added: Clojure 1.0 Examples: 4 Runnable: 1
([] [prefix-string])

Returns a new symbol with a unique name. If a prefix string is supplied, the name is prefix# where # is some unique number. If prefix is not supplied, the prefix is 'G__'.

Examples

by devn on . May have evaluation errors.
by devn on . May have evaluation errors.
by gdavis on . May have evaluation errors.
by tomdl89 on

Note by mlb

The

(. clojure.lang.RT (nextID))
present gensym's source code (https://github.com/clojure/clojure/blob/clojure-1.5.1/src/jvm/clojure/lang/RT.java#L468) uses java.util.concurrent.atomic.AtomicInteger (and has for the past 6 years, if you trust the Git history).


Content from the matching ClojureDocs page, with authors credited on each contribution.