I have this association-list in Common Lisp:
(defvar base-list (list (cons 'a 0) (cons 2 'c)))
I have to call assoc
when my argument is of type string
.
For the pair (A . 0)
I have to convert "a" to a symbol, and for the pair (2 . C)
I have to convert "2" to a symbol. How can I do that?
This should work like this:
CL-USER 28 : 1 > (assoc (convert-string-to-symbol "a") base-list)
(A . 0)
CL-USER 28 : 1 > (assoc (convert-number-to-symbol "2") base-list)
(2 . C)
I tried using intern
but got NIL
:
CL-USER 29 : 1 > (assoc (intern "a") base-list)
NIL