null之间的区别?空的?在Scheme中

unj*_*nj2 8 scheme

Berkeley的"CS 61A第8讲:UI递归和迭代III"说空?检查列表是否为空并且为空?检查列表是否为空或单词是否为空?讲师还接着说(null?empty)将返回false.但DrScheme根本不介意.

null之间有什么区别?空的?在Scheme?

Ale*_*lli 9

没有区别(用我最喜欢的方言 - empty?不符合标准,而且因为我使用了任何不同的方言,所以太长了;)......!引用PLT计划文档:

(null? v) ? boolean?
  v : any/c

Returns #t if v is the empty list, #f otherwise.
Run Code Online (Sandbox Code Playgroud)

(empty? v) ? boolean?
  v : any/c

The same as (null? v).
Run Code Online (Sandbox Code Playgroud)

  • 这个答案已经有将近十年的历史了,但只是想说 mit-scheme 只识别 `null?` (2认同)