Lecture overview -- Keyboard shortcut: 'u'  Previous page: Property lists -- Keyboard shortcut: 'p'  Next page: Other Data Types [Section] -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Introduction to Functional Programming in Scheme - slide 18 : 49

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

(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
          (string-append "Cannot convert to number "
                         (as-string x))))
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 this simple kind of (self) reflection.