简单的LISP问题

sch*_*opy 1 lisp common-lisp

我刚刚学习LISP而且我在执行以下操作时遇到了麻烦:

; return ":h :i"
(defun get-char() 
  (loop for char across "ab" 
        collect (concatenate 'string ":" (string char))))

; plist
(defun get-list() (list :a "1" :b "2"))

; I cannot get this to work 
; <-- returns all null, cannot get plist values :-(
(loop for x in (get-char) 
      collect (getf (get-list) x))

; this works fine...
(loop for x in '(:a :b) 
      collect (getf (get-list) x))
Run Code Online (Sandbox Code Playgroud)

我知道我很接近,但我只是遗漏了一些东西.

非常感谢 :-)

Ter*_*aug 5

更改get-char函数以从字符返回关键字列表:

(defun get-char() 
  (loop 
    for char across "ab" 
    collect (intern (string-upcase char) :keyword)))
Run Code Online (Sandbox Code Playgroud)

评估(get-char)=> (:A :B).此外:

(loop for x in (get-char) collect (getf (get-list) x))
Run Code Online (Sandbox Code Playgroud)

=>

("1" "2")
Run Code Online (Sandbox Code Playgroud)