mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
16 lines
500 B
Plaintext
16 lines
500 B
Plaintext
|
(doc *gensym-counter* "Is a helper counter for `gensym`.")
|
||
|
(defdynamic *gensym-counter* 1000)
|
||
|
|
||
|
(defndynamic gensym-local [x]
|
||
|
(Symbol.concat ['gensym-generated x]))
|
||
|
|
||
|
(doc gensym-with "Generates symbols dynamically, based on a symbol name.")
|
||
|
(defndynamic gensym-with [x]
|
||
|
(do
|
||
|
(set! *gensym-counter* (inc *gensym-counter*))
|
||
|
(Symbol.concat [x (Symbol.from *gensym-counter*)])))
|
||
|
|
||
|
(doc gensym "Generates symbols dynamically as needed.")
|
||
|
(defndynamic gensym []
|
||
|
(gensym-with 'gensym-generated))
|