If you make "multiple values" first-class then you get into an
interesting and useful design space.  See the XQuery language
(http://www.w3.org/XML/Query and http://www.w3.org/TR/xquery/).
Its values are "sequences" of "items".  The difference between a
list and a sequence is that sequences don't nest directly - and
there is no difference between an item and a sequence of length 1.
You can handle nesting by wrapping a sequence in a node or object
(though the latter goes beyond the XQuery data model).

XQuery doesn't goes as far as it could, because a parameter
list is not a sequence, but a list of sequences.  It would be
cleaner to define a parameter list as a sequence, and then
use pattern matching to split the sequence into parameters.

Sequences are nice because they're the natural result of
"statements" such are loops (see XQuery's FLOWR expressions)
or "blocks" (bodies in Scheme).

In Kawa XQuery sequence and Scheme multiple values are
implemented the same way.

Articles where I explore / ramble on this idea:
http://www.gnu.org/software/kawa/q2/
http://per.bothner.com/papers/LispXML04/index.html
--
        --Per Bothner
[EMAIL PROTECTED]   http://per.bothner.com/


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user

Reply via email to