Execute body while the test is true.macro (var in list do &body body)
Execute body for each element of list. VAR can be a list or tree of variables, in which case the elements are destructured.macro (var = start to end do &body body)
Execute body with var bound to succesive integers.macro (item sequence &rest keys &environment env)
Destructively delete item from sequence, which must be SETF-able.macro (&rest definitions)
Use this to conditionally define functions, variables, or macros that may or may not be pre-defined in this Lisp. This can be used to provide CLtL2 compatibility for older Lisps.
Is this a list of 2 or more elements?function (list)
Is this a list of exactly one element?function (list)
Return some element of the list, chosen at random.function (fn &rest lists)
Apply fn to respective elements of list(s), and append results.function (list element)
Is this a list that starts with the given element?function (list)
Return the last element of a list.function (list)
Move the first element to the end of the list.function (list)
Move the last element to the front of the list.function (list-of-lists)
Transpose a matrix represented as a list of lists. Example: (transpose '((a b c) (d e f))) => ((a d) (b e) (c f)).function (x y x-y)
Return (cons x y), or reuse x-y if it is equal to (cons x y)function (op &rest args)
Operator of an expressionfunction (exp)
Arguments of an expressionfunction (exp)
First argumentfunction (exp)
Second argumentfunction (exp)
Convert a fully parenthesized prefix expression into infix notation.function (item list)
Insert item between every element of list.
A two-dimensional (i.e. x and y) point.function (arg)
Is the argument a 2-D point?function (x y)
Create a 2-D pointfunction (p q)
Add two points, component-wise.function (p q)
The distance between two points.function (p q)
The 'city block distance' between two points.function (xy1 xy2 xy3)
Predicate; return t iff xy1 is between xy2 and xy3. Points are collinear.function (o a b c d)
Is the point l inside a rectangle from 0,0 to xmax,ymax?
Numerical average (mean) of a list of numbers.function (avg new n)
Calculate new average given previous average over n data pointsfunction (x)
function (numbers &optional key)
Add up all the numbers; if KEY is given, apply it to each number first.function (x y z)
Predicate; return t iff number x is between numbers y and z.function (predicted target)
Compute root mean square error between predicted list and target listfunction (predicted target)
Compute mean square error between predicted list and target listfunction (predicted target)
function (n &optional start-at)
Return a list of n consecutive integers, by default starting at 0.function (from to)
Return an integer chosen at random from the given interval.function (x mu sigma)
function (n population &optional m)
function (quantity &optional proportion round-off)
Add and also subtract a random fuzz-factor to a quantity.function (number precision)
Round off the number to specified precision. E.g. (round-off 1.23 .1) = 1.2
Don't do anything, and return nil.function (&rest args)
Ignore the arguments.function (&rest args)
Always return true.function (&rest args)
Always return false.function (&optional msg &rest args)
If this ever gets called, it means something that was required was not supplied. Use as default value for &key args or defstruct slots.
Coerce argument to a string.function (&rest args)
Concatenate the args into one string, and turn that into a symbol.function (array &key stream key width)
Print the contents of a 2-D array, numbering the edges.function (string width &optional stream)
Print STRING centered in a field WIDTH wide.function (string n &optional stream)
Print the string n times.function (width &optional stream separate-line)
Print a line of dashes WIDTH wide.
Make a copy of an array.function (a b indices dim)
Convert a multi-dimensional array to a vector with the same elements.function (alist file)
function (h1 &optional copy-fn)
Convert a hash table into a list of (key . val) pairs.function (h &optional stream)
prints a hash table line by linefunction (f g)
Return a function h such that (h x) = (f (g x)).function (fn l)
Echo all the args when *debugging* is true. Return the first one.
Define a set of test examples. Each example is of the form (exp test) or (exp). Evaluate exp and see if the result passes the test. Within the test, the result is bound to *. The example ((f 2))) has no test to fail, so it alweays passes the test. But ((+ 2 2) (= * 3)) has the test (= * 3), which fails because * will be bound to the result 4, so the test fails. Call (TEST name) to count how many tests are failed within the named test. NAME is the name of an aima-system.function (name examples)
The functional interface for deftest: adds test examples to a system.function (&optional name print?)
Run a test suite and sum the number of errors. If all is well, this should return 0. The second argument says what to print: nil for nothing, t for everything, or FAIL for just those examples that fail. If there are no test examples in the named system, put the system has other systems as parts, run the tests for all those and sum the result.function (example &optional print?)
Does the EXP part of this example pass the TEST?
node for binary search treefunction (root-elem root-key)
return dummy header for binary search tree, with initial element root-elem whose key is root-key.function (list-of-elems key-fun)
return binary search tree containing list-of-elems ordered according tp key-funfunction (root)
Predicate of search trees; return t iff empty.function (tree-node)
return leftmost descendant of tree-nodefunction (header)
return rightmost descendant of headerfunction (header)
return least element of binary search tree; delete from tree as side-effectfunction (header)
return largest element of binary search tree; delete from tree as side-effectfunction (header)
return least key of binary search tree; no side effectsfunction (header)
return least key of binary search tree; no side effectsfunction (element parent key &optional direction)
insert new element at proper place in binary search treefunction (element parent key &optional direction)
insert new element at proper place in binary search tree -- break ties randomlyfunction (element list)
return list with element destructively inserted at random into listfunction (element parent key &optional direction)
return t if element is int treefunction (element parent key &optional error-p)
delete element from binary search treefunction (tree-node)
return inorder-successor of tree-node assuming it has a right sonfunction (parent)
return list of elements in tree
Are there no elements in the queue?function (q)
Return the element at the front of the queue.function (q)
Remove the element from the front of the queue and return it.
Add a list of items to the front of the queue.function (q items)
Add a list of items to the end of the queue.function (q items key)
Insert the items by priority according to the key function.
Assume that the children of i are heaps, but that heap[i] may be larger than its children. If it is, move heap[i] down where it belongs. [Page 143 CL&R].function (heap key)
Pop the best (lowest valued) item off the heap. [Page 150 CL&R].function (heap item key)
Put an item into a heap. [Page 150 CL&R].function (&optional size)
Return a sorted list, with elements that are < according to key first.
Like PROGN, except provides control over restarts if there is an error.macro (lambda-list list &body body)
Bind the variables in lambda-list to the result list and execute body.
This is just like DEFSTRUCT, except it keeps track of :include types, for the benefit of METHOD-FOR, and it makes printing go through PRINT-STRUCTURE.method ((structure t) stream)
Print a structure. You can specialize this function. It will be called to print anything defined with DEFSTRUCTURE.macro (name ((var class) &rest other-args) &rest body)
This version of DEFMETHOD is like the CLOS version, except it only dispatches on the first argument, and it only handles structures and some built-in types, not classes.function (name)
Define NAME to be a generic function.function (type)
Find the most specific supertype of this type.function (name type var args)
Find the method for this type, following :supertype links if needed.
AIMA Home | Authors | Lisp Code | AI Programming | Instructors Pages |