Is there anything in Clojure that is equivalent to Common Lisp's
symbol-name
function?
There may be some confusion here from the different usages of the term "symbol" in Common Lisp and in Clojure. In Common Lisp, a "symbol" is a location in memory, a place where data can be stored. The "value" of a symbol is the data stored at that location in memory. In Clojure, a "symbol" is just a name.
In LISP, a symbol is a name that represents data objects and interestingly it is also a data object. What makes symbols special is that they have a component called the property list, or plist.
Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy and a powerful macro system. On the other hand, Common Lisp is detailed as "The modern, multi-paradigm, high-performance, compiled, ANSI-standardized descendant of the long-running family of Lisp programming languages".
Since Clojure is a Lisp-1, (global) functions can be dynamically rebound (if they are marked as dynamic).
The Clojure name function will return the name of the symbol, instead of the symbol itself.
(name symbol)
Answer by Stuart Sierra on Clojure group.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With