我想寫這個程序在列表中找到一個關鍵字。如果找到,然後打印列表。但錯誤發生,我無法解決它。請給我一些建議。我是lisp的新手。一個簡單的lisp程序
主程序是兩個dolist(兩個用於C),並在list(二維數組)列表中查找關鍵字。
(defun kanna_find (key)
(let (
(result 0)
(kanna-table (list
(list "あ" "ア" "a")
(list "い" "イ" "i")
)
) ;; End of kanna table
) ;; End of let var define
(dolist (result kanna-table)
(dolist (item result)
(if (string= item key)
(print result))
) ;; End of the second dolist
) ;; End of the first dolist
) ;; End of let
)
(kanna_find "あ")
下面是調試信息
Debugger entered--Lisp error: (void-variable )
(list "い" "イ" "i")
(list (list "あ" "ア" "a") (list "い" "イ" "i"))
(let ((result 0) (kanna-table ...)) (dolist (result kanna-table) (dolist ... ...)))
kanna_find("あ")
eval((kanna_find "あ"))
eval-last-sexp-1(nil)
eval-last-sexp(nil)
call-interactively(eval-last-sexp nil nil)
recursive-edit()
這些是*假名*不*日本漢字*。 :) – Kaz 2012-04-07 04:56:54
謝謝卡茲,你是對的。 :) – louxiu 2012-04-07 07:24:13