我正在使用LISP,并想知道如何访问字符串列表中的成员.我已经尝试了成员函数,但一直都是NIL.谢谢
(setq phrase-list '( "What color is the sky?" "It is Blue.")) ;list of strings
(write phrase-list)
(terpri)
(setq x(read-line)) ; I try to input What color is the sky?
(write(member x phrase-list)) ; I keep getting NIL
Run Code Online (Sandbox Code Playgroud)
您需要设置正确的测试功能
(member x phrase-list :test #'string=)
Run Code Online (Sandbox Code Playgroud)
或者也equal
应该工作.
有关Common Lisp 谓词的一些信息