Macro Define-Statistic

Part of:

package cl-mathstats
( define-statistic < name > &optional < superclasses > < slots > < values > < argument-types > < lambda-list > &body < body > )

In clasp, statistical objects have two parts, a class which stores the
various parts of the object and a computing function which computes the value
of the object from arguments. The define-statistic macro allows the
definition of new statistical types. The define-statistic macro must be
provided with all the information necessary to create a statistical object,
that is, everything required to create a new class, everything required to
create a computing function and some information to connect the two. This
last part consists of a list of arguments and their types and a list which
determines how the values of a statistical function should be used to fill the
slots of a statistical object.

When define-statistic is invoked, two things happen, first a class is defined
which is a subclass of 'statistic and any other named superclasses&#39;. Second,<br> a pair of functions is defined. clasp-statistics::name' is an internal
function which has the supplied body&#39; and lambda-list' and must return as
many values as there are slots in the class name&#39;. The function name' is
also defined, it is basically a wrapper function which converts its arguments
to those which are accepted by body&#39; and then calls clasp-statistics::name'.
The parameter clasp:create-statistical-objects determines whether the
wrapper function packages the values returned by the intern function into a
statistical object or just returns them as multiple values.

The argument-types&#39; argument must be an alist in which the keys are the<br> names of arguments as given in lambda-list' and the values are lisp types
which those arguments will be converted to before calling the internal
statistical function. The primary purpose of this is to allow for coersion of
clasp variables to sequences, but any coercion which is allowed by lisp is
acceptable. The `values' argument is intended to allow the programmer to
specify which slots in the statistical object are filled by which of the
values returned by the statistical function. By default, the order of the
values is assumed to be direct slots in order of specification, inherited
slots in order of specification in the superclasses which are also statistics.