Quite unexpectedly for lisps, but looking at the sequential integer generation code, I noticed that repeated calls (gensym)increased the number indicated after the prefix by 3. I wonder why this is so.
(gensym)
user=> (gensym) G__662 user=> (gensym) G__665 user=> (gensym) G__668 user=> (gensym) G__671 user=> (gensym) G__674 user=> (gensym) G__677
I have seen and understood sharing atomand inc, but I'm new to the function gensym.
atom
inc
gensym
There are a few correct answers here. One of them: it is not!
user> (take 5 (repeatedly gensym)) (G__2173 G__2174 G__2175 G__2176 G__2177)
: gensym , , , ( ). , , gensym .
: ? , repl, gensym. -, (gensym) , , .
!
=> (str (gensym) (gensym)) "G__4027G__4028"
gensym, , clojure.lang.RT/nextID.
(defn gensym ([prefix-string] (. clojure.lang.Symbol (intern (str prefix-string (str (. clojure.lang.RT (nextID))))))))
id LispReader. , (gensym), , , .
- , , gensym , 3.
https://github.com/clojure/clojure/search?q=nextid
Source: https://habr.com/ru/post/1540118/More articles:PHP: handling traits with methods of the same name - scopeAutomatic spreadsheet creation in Excel VBA - vbaHow to serialize the structure of objects of a tree class in json format? - jsonВыберите конкретные столбцы из рабочего листа, чтобы сохранить - filterAndroid will replace keyboard with Emoji slice - androidC # UDP Server Asynchronous Multiple ClientsBootstrap: problems with the navigation bar - cssМогу ли я написать плагин resharper для реорганизации пользовательского DSL, который генерирует код С# - c#Monoprocessing on Nitrous.io - installationCordoba uploads remote javascripts - javascriptAll Articles