Lecture overview -- Keyboard shortcut: 'u'  Previous page: Tables as lists of rows -- Keyboard shortcut: 'p'  Next page: Other Data Types [Section] -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home    Lecture 2 - Page 25 : 46
Functional Programming in Scheme
Expressions, Types, and Functions
Programs represented as lists

It is a unique property of Lisp that programs are represented as data, using the main data structure of the language: the list

A sample Scheme program from the LAML library:

(define (as-number x)
  (cond ((string? x) (string->number x))
        ((number? x) x)
        ((char? x) (char->integer x))
        ((boolean? x) (if x 1 0))  ; false -> 0, true -> 1
        (else
         (error
          (string-append "Cannot convert to number "
                         (as-string x))))

The function from the general library that converts different kinds of data to a number.

In Scheme it is not intended that the program source should be introspected by the running program

But in other Lisp systems there is easy access to self reflection