next up previous
Next: 2.2.3.2 J Programs Up: 2.2.3 Programs Previous: 2.2.3 Programs

2.2.3.1 Scheme Programs

A single sentence is a simple Scheme program. For example:

> (* (+ 4 5) (- 3 2))
9
Functions may be defined as compound sentences involving the special words define and lambda. For example:
(define square
    (lambda (x)
      (* x x)))
Then
> (square 10)
100
Data is described using the special word quote as follows:
(define people
    (quote ((Clinton (president United States))
            (Dole (wanted to be President))
            (Perot (also wanted to be President)))))
> (length people)
3

next up previous
Next: 2.2.3.2 J Programs Up: 2.2.3 Programs Previous: 2.2.3 Programs
2002-09-27