# Index to Scheme Functions and Special Forms

Note that this index provides references to places in the 287 lecture notes relating to standard Scheme functions, special forms and also functions which we define for the purposes of the class. The descriptions of the standard facilities of Scheme are not definitive, but serve to characterise the behaviour of these facilities adequately for the purposes of the class.

A definition of Scheme emanating from MIT is on-line in the UMASS Scheme system. It is close to the IEEE Standard.

This index is under construction. See \$popscheme/examples.scm for further examples. Section 6.6 onwards has lacunae.

## Index to topics covered in the course.

L:abstract The need for abstraction
L:higher-order functions How can we understand functions which return functions as results?
L:parsers Making parser-building functions

## Index to functions and special forms

->string Converts any Scheme object to a string
() The empty list
and    The construct (and expr-1....expr-n) is a special form.
append    The append  function joins two lists together to make one.
apply Evaluating (apply f list) function explicitly applies a function f to a list of arguments
assoc (assoc x alist)finds entry for x in alist
assq (assq x alist)finds entry for x in alist, using eq?
assv (assv x alist)finds entry for x in alist
atom (atom obj) is true if obj is not a pair
average    Writing average to find the average value of a list.
begin    (begin expr1..exprn) evaluates the expressions in sequence
boolean? recognises if an object is a boolean
cadr (cadr l) = (car (cdr l)) is the second member of l
car (car l) is the first member of the list l
case (case expr cases) chooses a case depending on the value of expr
cddr (cdr (cdr l)) is a list of all members of the list l except the first two
cdr (cdr l) is a list of all members of the list l except the first
char? recognises if an object is a character
cond    The cond  special-form is more convenient than nested if's
cons Making Lists.
cons_parse (cons_parse tree rest) builds a parse-record
cos The cosine function. Call (cos t) where the angle t is in radians.
count_occurrences (count_occurrences a l) finds if atom a occurs in list structurel
define (define form expr) is a shorthand way of defining a function
define    (define variable expr) declares and binds a variable
display    (display obj) outputs an object to the terminal
do
equal?
eqv?
eq?
example    The example  function allows you run tests on functions as you compile
factorial Recursive and iterative processes for factorial.
factorial The factorial function - an example of recursion
fib The Fibonacci Numbers - A simple definition gives exponential complexity
flatten (flatten tree) makes a list of all the objects stored in nodes of tree.
if The (if condition expr1 expr2) construction
lambda    An expression (lambda(v1..vn) expr) denotes a function .
lambda    lambda   expressions which take a variable number of arguments
last
length (length l) is the number of elements in list l
let    (let (binding1..bindingn)body) introduces local variables
let*    (let* (binding1..bindingn)body) also introduces local variables
letrec    (letrec (binding1..bindingn)body) lets you write local recursions
list    The list  function is more convenient than cons  for building longer lists.
list-tail
lookup (lookup x alist)finds value for x in alist
map The map  function is built-in, resembles map_list .
map_list The "map_list" function transforms a list in a general way.
map_list   Some examples of the use of map_list
member    The expression (member x list)   finds an object x in the list.
member?    The member?   function asks whether an object belongs to a list
memq This is like member but uses eq? for comparison
memv This is like member but uses eqv? for comparision
mk_builder (mk_builder label) makes a builder for abstract syntax
mk_parser_seq (mk_parser_seq p1 p2 b) combines two parsers in sequence
mk_parser_singleton makes a parser to recognise 1-element sequences
not (not expr) is the logical negation of the value of expr.
nth-cdr
null? recognises if an object is the null object '()
number? recognises if an object is a number
occurs_atom? (occurs_atom? a l) finds if atom a occurs in list structure l
or    The construct (or expr-1...expr-n) is a special form.
pair? recognises if an object is a pair
parse_determiner (parse_determiner ltoks) recognises if ltoks starts with a determiner
parse_noun (parse_noun ltoks) recognises the grammatical class "noun"
parse_noun_phrase (parse_noun_phrase ltoks) recognises the grammatical class "noun_phrase"
parse_sentence (parse_sentence ltoks) recognises the grammatical class "sentence"
parse_verb (parse_verb ltoks) recognises the grammatical class "verb"
parse_verb_phrase (parse_verb_phrase ltoks) recognises the grammatical class "verb_phrase"
procedure? recognises procedure objects, that is functions
quote Quoted Expressions are Compound Data.
record-class Using record-class to create opaque records.
reduce    The reduce  function further generalises map_list .
rest_parse (rest_parse tree rest) selects the unparsed list of tokens from a parse-record
reverse (reverse l) makes a list of the objects of l in reverse order
select_set The select_set  function lets you choose members out of a list
set! (set! variable expr) evaluates the expression and binds the variable to have the value.
set! expr1 expr2) evaluates the expr2 and updates the appropriate component of expr1 [non-standard]
set-car! (set-car! list expr) sets the first element of list to be the value of expr
set-cdr!
sin The sine function. Call (sin t) where the angle t is in radians.
sqrt The square-root function. Call (sqrt t). Result may be a complex number.
string? recognises if an object is a string such as "hello"
subst (subst x y l) replaces all occurrences of atom x by y in list structurel
symbol? recognises if an object is a symbol such as 'x
symbol->string
trace    The trace  function allows you to see what a program is doing.
tree_parse (tree_parse tree rest) selects the parse-tree from a parse-record
vector? recognises if an object is a vector
unify sees if two expressions can be made the same
updater supports (set! (f x) val) etc...
write    (write obj) outputs an object read to be read back into Scheme
zero? (zero? n) determines whether a number is zero.