17.05.2015 Views

zl:1 - FTP

zl:1 - FTP

zl:1 - FTP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

defwhopper<br />

162<br />

For example, <strong>zl</strong>: base is defined like this:<br />

(defvar-standard <strong>zl</strong> :base 18. 18. 18. validate-base)<br />

(defun validate-base (b)<br />

(and (fixnump b) « 1 b 37.»)<br />

See the section "Standard Variables" in Symbolics Common Lisp: Language<br />

Concepts.<br />

I<br />

defwhopper<br />

Special Form<br />

The following form defines a whopper for a given generic-function when applied<br />

to the specified flavor:<br />

(defwhopper (generic-function flavor) (argl arg2 .. )<br />

body)<br />

The arguments should be the same as the arguments for any method performing<br />

the generic function.<br />

When a generic function is called on an object of some flavor, and a whopper<br />

is defined for that function, the arguments are passed to the whopper,<br />

and the code of the whopper is executed.<br />

Most whoppers run the methods for the generic function. To make this<br />

happen, the body of the whopper calls one of the following two functions:<br />

continue-whopper or lexpr-continue-whopper. At that point, the before<br />

daemons, primary methods, and after daemons are executed. Both<br />

continue-whopper and lexpr-continue-whopper return the values returned<br />

by the combined method, so the rest of the body of the whopper can use<br />

those values.<br />

If the whopper does not use continue-whopper or lexpr-continue-whopper,<br />

the methods themselves are never executed, and the result of the whopper<br />

is returned as the result of calling the generic function.<br />

Whoppers return their own values. If a generic function is called for value<br />

rather than effect, the whopper itself takes responsibility for getting the<br />

value back to the caller.<br />

For more information on whoppers, including examples: See the section<br />

"Wrappers and Whoppers" in Symbolics Common Lisp: Language Concepts.<br />

defwhopper-subst (flavor generic-function) lambda-list &body body Macro<br />

Defines a wrapper for the generic-function when applied to the given flavor<br />

by combining the use of defwhopper with the efficiency of defwrapper.<br />

The following example shows the use of defwhopper-subst.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!