Subject: question regarding multiple-value-bind

From: [email-masked] (Dan Stanger)
Date: Mon, 27 Feb 1995 13:49:38 -0700

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?
thanks,
dan stanger

---

From: Johann Petrak <[email-masked]>
Date: Thu, 9 Mar 1995 16:24:24 +0100

> 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: [email-masked]
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

---

From: haible (Bruno Haible)
Date: Thu, 9 Mar 95 17:37:07 +0100

[Forwarded from Bill Barry <[email-masked]>.]

Return only returns from inside an implicit or explicit block.
Unlike some macros such as do, it seems that multiple-value-bind
is not enclosed in an implicit block.
You could use
(multiple-value-bind (x y) (values 1 2) nil)

Bill Barry