# John's MITScheme Quickstart

When I learned scheme six years ago, I learned on a Mac-specific version of Scheme. As a result, I'm as new to MITScheme as you are! As I learn useful things, I'll be sure to add them below. I hope that this helps!

• MIT Scheme User's Manual

• Tips on editing scheme code in xemacs from Grinnell's Math Dept (found on Google using "xemacs scheme" as a search term)

## Tips On Using Scheme (for the first time)

I couldn't find a concise source, so I'm making my own! Most of the info comes from the MIT Scheme User's Manual.
"%" means the shell prompt, "]=>" is the scheme "read" prompt.
• To start Scheme from the command line:

% scheme

• To quit Scheme: type Control-d or "(exit)"

• To load a source file (i.e. "foo.scm") from inside of scheme:

• To load a source file (i.e. "foo.scm") when starting scheme:

• To leave the "error>" prompt, type: Control-g

• Now let's test a few in-class examples:
```1 ]=> 1

;Value: 1

1 ]=> #t

;Value: #t

1 ]=> coffee

;Unbound variable: coffee
; (RESTART 3) => Specify a value to use instead of coffee.
; (RESTART 2) => Define coffee to a given value.
```
Oh Well...I was hoping for some french roast...
```2 error>
;Quit!

1 ]=> (+ 1 2)

;Value: 3

1 ]=> (* 3 4)

;Value: 12
```
It's worth noting that these functions can take more than two arguments:
```1 ]=> (+ 1 2 3 4 5)

;Value: 15

1 ]=> (define pi 3.14)

;Value: pi

1 ]=> pi

;Value: 3.14

1 ]=> (define circ (* 2 pi radius))

;Value: circ

1 ]=> circ

;Value: 12.56

1 ]=> circ

;Value: 12.56636

What went wrong here?
Obviously, just like Harry's "n" example yesterday, circ evaluates to a number, not to an expression.
How do I fix it?

1 ]=> (define (circ) (* 2 pi radius))

;Value: circ

You'll learn Monday that those subtle parentheses are just "syntactic sugar" for:

1 ]=> (define circ (lambda () (* 2 pi radius)))

;Value: circ

1 ]=> (circ)

;Value: 18.849539999999998

1 ]=> (circ)

;Value: 31.4159

And now finally to load the file for Problem Set 1: