代码之家  ›  专栏  ›  技术社区  ›  H P

字符串列表上的lisp成员函数

  •  0
  • H P  · 技术社区  · 8 年前

    我正在使用LISP,想知道如何访问字符串列表中的成员。我已经尝试了成员函数,但一直得到零。 谢谢

    (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
    
    1 回复  |  直到 8 年前
        1
  •  8
  •   siehe-falz    8 年前

    您需要设置正确的测试功能

    (member x phrase-list :test #'string=)
    

    或者 equal

    关于公共Lisp的一些信息 predicates