Is it lat? primitive function in a schema?

Suppose l is defined as follows:

> (define l (list 1 2 3))

l is now tied to a list of atoms.

Little Schemer introduces a simple lat? which evaluates #t or #f depending on the classification of the arguments as a list of atoms. For instance,

> (lat? l)

must be evaluated to #t, since l is a list of three atoms.

However, my schema interpreter ( repl.it ) gives an error message when calling lat ?.

> (lat? l)
Error: execute: unbound symbol: "lat" []

Am I really mistaken in the adoption of armor? is primitive to a circuit?

Also, please excuse me for doing this.

+4
source share
2 answers

w? defined at the beginning of the book. See page nineteen.

(define lat?
(lambda (l)
  (cond
    ((null? l) #t)
    ((atom? (car l)) (lat? (cdr l)))
    (else #f))))

, , .

+8

, : . , - :

(define lat?
  (lambda (l)
    (cond
      ((null? l) #t)
      ((atom? (car l)) (lat? (cdr l))
      (else #f))))
+1

All Articles