Re: multiple-value-bind only accepts symbols
- From: Juho Snellman <jsnell@xxxxxx>
- Date: 17 Oct 2005 10:38:29 GMT
<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."
.
- Follow-Ups:
- Re: multiple-value-bind only accepts symbols
- From: Philippe Lorin
- Re: multiple-value-bind only accepts symbols
- References:
- multiple-value-bind only accepts symbols
- From: Philippe Lorin
- multiple-value-bind only accepts symbols
- Prev by Date: Re: gensym with multiple-value-bind
- Next by Date: Lisp and OpenGL on Unix
- Previous by thread: multiple-value-bind only accepts symbols
- Next by thread: Re: multiple-value-bind only accepts symbols
- Index(es):
Relevant Pages
|