The Seasoned Schemer 026256100X, 9780262561006

Table of contents : Cover......Page 1 Contents......Page 2 Foreword......Page 3 Preface......Page 4 11. Welcome Back to

113 16 11MB

English Pages 216 Year 1996

Report DMCA / Copyright

DOWNLOAD PDF FILE

Recommend Papers

The Seasoned Schemer
 026256100X, 9780262561006

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

There is no answer for

x2

Yes , X2 is an imaginary name just as . . Imagmary name.

Do omnivore and gobbler observe The Sixteenth Commandment?

They do. The name in (set! . . . ) is introduced by a (let ...) .

What is the value of nibbler

Unimaginable. Keep reading.

Xl

is an

.

. (define nibbler (lambda (food) (let ((x (quote donut) ) ) (set! x food) (cons food (cons x (quote 0))))))

\iVhat is the value of (nibbler (quote cheerio) )

(cheerio cheerio) .

Does nibbler still know about cheerio

No!

How do we determine the value of (nibbler (quote cheerio) )

First, we determine the value of (quote don ut), which is easy. And then we give it a name: x .

And second?

Second, we change what cheerio.

And third?

Third, we determine the value of (cons food (cons x (quote 0))) where x is cheerio and food is cheerio.

100

x

stands for to

Chapter 15

So ,,"hat was t hc use of (let" " " )

one" If (let" " ) and (set! ) ar \ l ret without a (lambda" b tW,('ll them, th don't h lp us to remember things. "

"

"

"

"

"

.v

Because there is no (lambda bet\\"eCll the (let ( ( x " ) ) "" . ) and t he (set! x " . " ) in (lambda (food)

So why is it unimaginable?

"

"

(let ( ( x (quote don ut ) ) ) (set! x food) ) )" "

"

The Seventeenth Commandment

Use (set!

x

(preliminary version) ) for (let (( )) x ...

...

there is at least one (lambda ... and the (let

((

x ...

))

.

.

.

)

.

.

.

)

only if

between it

.

Isn't (let ...) like (letrec ... )

Yes , we said it was similar.

Do you think The Sixteenth and Seventeenth Commandments also apply to names in the name part of (letrec ... )

Yes, they do, and we will see examples of t his, but not just yet.

Why did we forget The Sixteenth Commandment earlier?

Occasionally we need to ignore commandments, because it helps to explain things.

The Dife f rence Between

fen and BOJ"

10 1

!1G)� ru�� � �c �

"

/

,

o ,

I

"

I

,