!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (email@example.com), CBLU, University of Leeds >
Common Lisp the Language, 2nd Edition
New functions operating on series can be defined just as easily as new functions operating on any other data type. However, expressions containing these new functions cannot be transformed into loops unless a complete analysis of the functions is available. Among other things, this implies that the definition of a new series function must appear before its first use.
The declaration specifier (optimizable-series-function integer) indicates that the function being defined is a series function that needs to be analyzed so that it can be optimized when it appears in series expressions. (A warning is issued if the function being defined neither takes a series as input nor produces a series as output.) Integer (default 1) specifies the number of values returned by the function being defined. (This cannot necessarily be determined by local analysis.) The only place optimizable-series-function is allowed to appear is in a declaration immediately inside a defun. As an example, the following shows how a simplified version of collect-sum could be defined.
(defun simple-collect-sum (numbers) (declare (optimizable-series-function 1)) (collect-fn 'number #'(lambda () 0) #'+ numbers))
The declaration specifier
(off-line-port port-spec1 port-spec2 ...) specifies that the
indicated inputs and outputs are off-line. This declaration
specifier is only allowed in a defun that contains the declaration
optimizable-series-function. Each port-spec must either be a symbol
that is one of the inputs of the function or an integer j indicating the
jth output (counting from zero). For example, (off-line-port x 1)
indicates that the input x and the second output are off-line.
Every port that is not mentioned in an off-line-port
declaration is assumed to be on-line. A warning is issued whenever a
port's actual on-line/off-line status does not agree with its declared
status. This makes it easier to keep track of which ports are off-line and
which are not. Note that off-line ports virtually never arise when
defining scanners or reducers.