[alexandria-devel] [patch] implement multiple-value-or

Nikodemus Siivola nikodemus at random-state.net
Wed Dec 19 13:28:25 UTC 2007


On Dec 3, 2007 4:19 PM, Andreas Fuchs <asf at boinkor.net> wrote:
> On Dec 3, 2007, at 16:51, Andreas Fuchs wrote:
> > <multiple-value-or.patch>
>
> Eek, fe[nl]ix told me about a brain fart in that patch: I am using
> apply #'values instead of values-list. Here's an updated patch:

Thank you! Merged, but as NTH-VALUE-OR instead, as it seems to represent
the intention better. In my mind MULTIPLE-VALUE-OR would be something
like

 (values-list (or (every #'identity (multiple-value-list form1))
              ...)

or maybe

 (values-list (or (let ((values (multiple-value-list form1)))
                    (and (car values) values))
                  ...))

Also: perhaps we should return only N first values from all but the last
form? That would allow implementation without consing up a values list
for each form.

Are there cases where one wants N+M values, but tests only the Nth one?

Cheers,

 -- Nikodemus



More information about the alexandria-devel mailing list