[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question regarding multiple-value-bind



> when i execute the following i get this error.
> (multiple-value-bind (x y) (values 1 2) (return nil))
>  
> *** - RETURN-FROM: no block named NIL is currently visible
> 1. Break>
> could someone explain why this is a error?
Why shouldn't it be? There is no block around the return and therefore
no return can be used. The multiple-value-bind will return the last value
after the values-form, so
(multiple-value-bind (x y) (values 1 2)) ==> nil
(multiple-value-bind (x y) (values 1 2) y) ==> 2
etc.

To use return, use block, or do it inside one of the forms that
implicitly create a block named nil:

(block nil (multiple-value-bind (x y) (values 1 2) (return nil))) ==> nil

Johann Petrak                            Email: johann@ai.univie.ac.at
Austrian Research Institute for          Phone:        +43-1-533-61-12
Artificial Intelligence                                +43-1-535-32-81/0
Schottengasse 3                          Fax:          +43-1-532-06-52
A-1010 Vienna, AUSTRIA                   Private Phone:+43-1-24-03-173
					 http://www.ai.univie.ac.at