[alexandria-devel] Review cycle 3: WHICHEVER, XOR

Nikodemus Siivola nikodemus at random-state.net
Mon Apr 5 16:55:11 UTC 2010


[ Starting this in spite of SWITCH still being on the table, trying to
clear some others into blessed state. ]

macro MULTIPLE-VALUE-PROG2 first-form second-form &body forms

  "Evaluates FIRST-FORM, then SECOND-FORM, and then FORMS. Yields as its value
all the value returned by SECOND-FORM."

macro NTH-VALUE-OR nth-value &body forms

  "Evaluates FORM arguments one at a time, until the NTH-VALUE returned by one
of the forms is true. It then returns all the values returned by evaluating
that form. If none of the forms return a true nth value, this form returns
NIL."

macro WHICHEVER &rest possibilities

  "Evaluates exactly one of POSSIBILITIES, chosen at random."

macro XOR &rest datums

  "Evaluates its arguments one at a time, from left to right. If more then one
argument evaluates to a true value no further DATUMS are evaluated, and NIL is
returned as both primary and secondary value. If exactly one argument
evaluates to true, its value is returned as the primary value after all the
arguments have been evaluated, and T is returned as the secondary value. If no
arguments evaluate to true NIL is retuned as primary, and T as secondary
value."

All seem fine to me -- both in terms of docstring and implementation,
and they even have tests of sort. Unless there are objections during
this week, I'll move them into blessed section in package.lisp.

Cheers,

 -- Nikodemus




More information about the alexandria-devel mailing list