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 and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 1 - Page 18 : 49
Programming Paradigms
Introduction to Functional Programming in Scheme
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
        (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 this simple kind of (self) reflection.