{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

notes40 - The Scheme-1 interpreter[This topic may be in...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
The Scheme-1 interpreter [This topic may be in week 5 or in week 6 depending on the holiday schedule.] We’re going to investigate a Scheme interpreter written in Scheme. SICP has a rather large and detailed Scheme interpreter in Chapter 4, which we’ll get to near the end of the semester. But students often find that program intimidating, so we’re going to work up to it with a series of three smaller versions that leave out some details and some of the features of real Scheme. This week we’ll use the Scheme-1 interpreter. We weren’t ready for this investigation until we had the idea of lists that contain sublists, because that’s what a Scheme program is – a list. That’s the point of all those parentheses; the Scheme language can look at a Scheme program as data, rather than as something different from data. Here’s how we use the interpreter: STk> (load "~cs61a/lib/scheme1.scm") STk> (scheme-1) Scheme-1: (+ 2 3) 5 Scheme-1: ((lambda (x) (* x 3)) 4) 12 To leave Scheme-1
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}