1

像这样的表达式会导致错误

(= nil 3)


Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
=(nil .......

那么有没有一种简单的方法(例如,另一个名为 的函数my-eq)让这个表达式返回nil(意味着 False),如下所示:

(my-eq nil 3)
=> nil
4

1 回答 1

3

那是eqequal

(当量 3 无)

=> 无

(eq OBJ1 OBJ2)

Return t if the two args are the same Lisp object.

(equal O1 O2)

Return t if two Lisp objects have similar structure and contents.
They must have the same data type.
Conses are compared by comparing the cars and the cdrs.
Vectors and strings are compared element by element.
Numbers are compared by value, but integers cannot equal floats.
 (Use `=' if you want integers and floats to be able to be equal.)
Symbols must match exactly.
于 2012-12-28T10:09:13.803 回答