Recommand · June 12, 2021 0

What does this error mean in Scheme programing?

What is this #integer-zero? And why am I getting this error?

  (+ (cube (car i)) (cube (cdr i))))

(rw (list 2 3))```

The object (2), passed as the first argument to integer-zero?, is not the correct type.

There are built-in procedures integer? and zero?, which are both predicates. The first one will return #t if its argument is of integer type (#f otherwise), and the second one will return #t if we pass it a 0 (expects a number?).

I will assume, in your implementation, you have the both in one as integer-zero?. In any way, your program passes it the (2) which is a result of the (list 2) expression. Like this:

> (list 2)
(2) ;; Returns list with only a 2 in it