lisp中的“in”函数
autolisp中是否有与通用“in”函数等效的函数?我的意思是当我有一个参数,我想检查它是否包含在其他参数列表中。例如:
“3”“4”“5”中的“1”
将返回false
“3”“4”“5”中的“4”
将返回true
??? 使用会员声明–应将其应用于列表:
(member "1" '(3" "4" "5"))
返回零(False)
(member "4" '("3" "4" "5"))
返回T(真)
当做 谢谢 犯了一个错误:成员声明将不返回T,而是返回列表中测试项后面的部分。很抱歉给您带来不便。
但是,如果需要,T可以在函数中编写自己的函数:
(defun in( theItem theList / )
(if (member theItem theList) T)
)
当做 另一种剥猫皮的方法:
(defun in (theItem theList) (and (member theItem theList)))
页:
[1]