Re: multiple-value-bind only accepts symbols



<palpalpalpal@xxxxxxxxx> wrote:
> Is there a reason multiple-value-bind only accepts symbols, not places?
> And what would be the best way to do the equivalent with places? I can
> write this, but it's a bit ugly:
>
> (let ((a-and-b (multiple-value-list
> (some-function-that-returns-two-values))))
> (setf (slot-a x) (first a-and-b))
> (setf (slot-b x) (second a-and-b)))

Because that's not what binding means (have a look at the CLHS glossary).
The less ugly way to write this is:

(setf (values (slot-a x) (slot-b x))
(some-function-that-returns-two-values))

--
Juho Snellman
"Premature profiling is the root of all evil."
.



Relevant Pages