1.nil 和 true 求值时,返回自身
nil → nil
true → true
2.false、undefined 和 null 求值时,返回 nil
false → nil
undefined → nil
null → nil
3.TeaScript 中,nil 和 true 有两层含义:代表符号和代表布尔值。 根据它们所处的上下文不同,nil 和 true 被分别对待。
(setq lst '(nil nil nil)) → (nil nil nil)
(map symbol? lst) → (true true true)
上例中,nil 代表符号。下面例子中, nil 和 true 求值为布尔值:
(if nil "no" "yes") → "yes"
(if true "yes" "no") → "yes"
(map not lst) → (true true true)
4.在流程控制表达式中,如:if、unless、while、 until 和 not,nil 求值产生布尔值 false, true
求值产生布尔值 true。
5.TeaScript 中,nil 和空列表 () 是不同的东西。 仅当使用于条件表达式中时, 如:and、or、if、while、 unless、until 和 cond,它们视为布尔值 false。
6.表达式 (cons 'x '()) 求值时产生 (x),但 (cons 'x nil) 求值为 (x nil)。 因为 nil 求值时视其为布尔值而不是空列表。 TeaScript 中,对于代入两个原子型参数的 cons 函数不会产生点对列表,而是生成一个包含两个元素的列表。对于 nil 判别函数 atom? 结果为 true ,但对于空列表则相反false。因此,TeaScript 中的空列表仅只是空列表, 而不等于 nil。
7.this 符号在构造函数中求值时,返回新创建的对象。调用方法时,返回当前调用者对象。
8.arguments 求值时,返回函数代入的所有实际参数列表。