Difference between zero? and empty? in the scheme

Berkeley "CS 61A Lecture 8: UI Recursion and Iteration III" states that zero? checks if empty and empty? checks if the list is empty or the word is empty? The lecturer also says that (null? Empty) will return false. But DrScheme does not detract at all.

What is the difference between zero? and empty? in the circuit?

+5
source share
4 answers

It makes no difference (in my favorite dialect - it’s empty?not in the standard, and it's too long since I used any other dialect;) ...! Citation PLT schema documents :

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

Returns #t if v is the empty list, #f otherwise.

and

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

The same as (null? v).
+6
source

Neither R5RS nor R6RS are defined empty?as a predicate, and both are defined null?as follows:

#t, obj - , #f.

+4

      ( ? null?)       (define empty '())

+1

? PLT; , null?.

0

All Articles