I've spent a day reading page 166's length≤1
in the book The Little Schemer; there's the following code:
(((lambda (mk-length)
(mk-length mk-length))
(lambda (mk-length)
(lambda (l)
(cond
((null? l) 0)
(else (add1
((mk-length eternity)
(cdr l))))))))
l)
where l
is (apples)
and eternity
is as follows:
(define eternity
(lambda (x)
(eternity x)))
Page 166 (4th ed.) states that:
When we apply
mk-length
once, we getlength≤1
And then
Could we do this more than once?
But I do not know how to do this for getting length≤2
?
length≤2
specifically (i.e. only 2, not more). – Nestling