|
68
|
| Cristián Romo · 技术社区 · 17 年前 |
|
|
1
74
从 Common Lisp: Equality Predicates
下面是我链接到上面同一页的一些示例:
|
|
|
2
28
更多注意事项:
还有一个大致的指南: To compare against... Use...
Objects/Structs EQ
NIL EQ (but the function NULL is more concise and probably cheaper)
T EQ (or just the value but then you don't care for the type)
Precise numbers EQL
Floats =
Characters EQL or CHAR-EQUAL
Lists, Conses, Sequences EQ (if you want the exact same object)
EQUAL (if you just care about elements)
Strings EQUAL (case-sensitive), EQUALP (case-insensitive)
STRING-EQUAL (if you throw symbols into the mix)
Trees (lists of lists) TREE-EQUAL (with appropriate :TEST argument)
请注意,对于效率,通常等于eq>>eql>>equal>>equal。 |
|
|
3
11
从 here 还有我老师的幻灯片
例如:
(eq__a__b)无
例如:
(EQL 4 4)零
现在注意 差异 :
(式4.0 4.0)无;取决于第一(接受)答案中所述的平台
在某些实现上(eq 4.0 4.0)可能返回true,因为标准中没有指定一个实现是否应该在内存中只保留一个数字和字符的副本,就像它对符号所做的那样)。 不要在数字和字符上使用eq , 除非你真的知道你在做什么。
例如:
(等于4 4)t
现在注意 差异
(eql(cons'a'b)(cons'a'b))无
例如: (等于(cons'a'b)(cons'a'b))t; 平等一样 现在注意 差异
等于(4 4.0)零
|
|
|
tomm · 谷歌表格-将两列相乘,复制第三列 4 年前 |
|
|
ziemsterr · 无法在SQL SELECT语句中找出此语法错误 4 年前 |
|
|
Andrés BolÃvar · AJAX请求未收到我想要的属性 4 年前 |
|
|
clarkk · 当声明向量时,(1)是什么意思? 4 年前 |
|
|
Mike C. · Bash错误[:检查文件是否存在时缺少“]” 4 年前 |
|
|
michael · 错误的脚本和语法问题 4 年前 |