Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lisp return String of Symbol name

Basically I'm looking for a function that does the opposite of the following.

(intern "CAR")

This question is related. In Common Lisp, is there a function that returns a symbol from a given string?

like image 564
Lime Avatar asked Sep 19 '15 19:09

Lime


2 Answers

Either string or symbol-name would work to get the name of a symbol.

If you know specifically that you're passing n a symbol, symbol-name might allow both a compiler to generate better code as well as signal to a human reader that the argument is expected to be a symbol.

like image 25
Vatine Avatar answered Nov 09 '22 04:11

Vatine


The operator you are looking for is string (see the manual):

(string (intern "CAR"))

returns "CAR".

like image 73
Renzo Avatar answered Nov 09 '22 04:11

Renzo