convert char to symbol
Posted: Thu Jan 31, 2013 8:40 am
Hi,
Related to this other post http://lispforum.com/viewtopic.php?f=2&t=4091
If have this function:
(defun char1()
(let ((mychar (read-char *standard-input*)))
'y
)
)
always return: Y
This other function:
(defun char2()
(let ((mychar (read-char *standard-input*)))
mychar
)
)
always return: #\y
(defun char3()
(let ((mychar (read-char *standard-input*)))
(string mychar)
)
)
always return: "y"
The only function that works fine is the first, because its returning only the literal y, but I don't want to hardcode the y, I need to obtain from the user.
I need that the char readed can be converted to a symbol but I don't know how. The second function returns a char with #\. The third function return a string with doubles quotes, but I need to return a symbol, not char #\ or not string "". Is there any function to convert char to symbol?
Thanks
Related to this other post http://lispforum.com/viewtopic.php?f=2&t=4091
If have this function:
(defun char1()
(let ((mychar (read-char *standard-input*)))
'y
)
)
always return: Y
This other function:
(defun char2()
(let ((mychar (read-char *standard-input*)))
mychar
)
)
always return: #\y
(defun char3()
(let ((mychar (read-char *standard-input*)))
(string mychar)
)
)
always return: "y"
The only function that works fine is the first, because its returning only the literal y, but I don't want to hardcode the y, I need to obtain from the user.
I need that the char readed can be converted to a symbol but I don't know how. The second function returns a char with #\. The third function return a string with doubles quotes, but I need to return a symbol, not char #\ or not string "". Is there any function to convert char to symbol?
Thanks