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.

103 condition-bind<br />

Examples:<br />

(cond-every) => NIL<br />

(cond-every ((> 2 3) (print "sister"»<br />

((= 2 3) (print "brother"») => NIL<br />

(cond-every ((equal 'mom 'mom) (princ "mother H»~<br />

((equal 'dog 'cat) (princ "pet dog"»<br />

((equal 'dad 'dad) (princ "father"»)<br />

=> mother father"father"<br />

(cond-every ((= 1 1) t) ((= 2 2) "yes!")<br />

(otherwise "no"» => "yes!"<br />

For a table of related items: See the section "Conditional Functions" in<br />

Symbolics Common Lisp: Language Concepts.<br />

condition-bind list &body body Special Form<br />

condition-bind binds handlers for conditions and then evaluates its body<br />

with those handlers bound. One of the handlers might be invoked if a condition<br />

is signalled while the hody is being evaluated. The handlers bound<br />

have dynamic scope.<br />

The following simple example sets up application-specific handlers for two<br />

standard error conditions, fs:file-not-found and fs:delete-failure.<br />

(condition-bind ((fs:file-not-found 'my-fnf-handler)<br />

(fs:delete-failure 'my-delete-handler»<br />

(deletef pathname»<br />

The format for condition-bind is:<br />

(condi t ion-bi nd ((condition-flavor-l handler-l)<br />

(condition-flavor-2 handler-2)<br />

I<br />

form-l<br />

form-2<br />

(condition-flavor-m handler-m»<br />

form-n)<br />

condition-flavor-j The name of a condition flavor or a list of names of condition<br />

flavors. The condition-flavor-j need not be unique<br />

or mutually exclusive. (See the section "Finding a<br />

Handler" in Symbolics Common Lisp: Language Concepts.<br />

Search order is explained in that section.)

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

Saved successfully!

Ooh no, something went wrong!