| car | (car L) | returns the value of the first element of L, which may be an atom or a list. |
| cdr | (cdr L) | returns the list that remains when the first element has been removed. The value is a list (which may be the empty list) |
| cons | (cons x L) | creates a new list consisting of the list L with an extra element inserted at the front. For instance, (cons 3 '(1 2)) returns (3 1 2). |
| null? | (null? L) | a predicate, returns T if L is the null list, NULL otherwise. |
| list? | (list? L) | a predicate, returns T if L is a list, NULL otherwise. |
| + | (+ a b) |
arithmetic operation, returns sum of its arguments. May have any number of arguments. |
| - * / |
(- a b) (* a b) (/ a b) |
arithmetic operations, return a-b, a*b, a/b, respectively. |
| first | (first L) | returns the first element of list L. Same as (car L). |
cadr |
(cadr L) |
shorthand for (car (cdr L)), (cdr (cdr L)), (car (cdr (cdr L))), ... |
| define | (define x expr) | create a variable x with the value of expr assigned as value. Examples: (define x 3), (define y (cdr L)). Note expr is evaluated then assigned. |
| lambda | (lambda (args) expr) | create a function with args (a list of 0 or more atoms) as arguments,
and return value specified by expr. Arguments are passed by value. Example: |
To load a file of LISP commands:
(define filepath "C:\\Program Files\\MIT\\scheme\\myProg.txt")
(load filepath)