[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: values->list elements

From: Per Bothner
Subject: Re: values->list elements
Date: Tue, 13 Jun 2006 15:24:45 -0700
User-agent: Thunderbird (X11/20060420)

If you make "multiple values" first-class then you get into an
interesting and useful design space.  See the XQuery language
( and
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:
        --Per Bothner

reply via email to

[Prev in Thread] Current Thread [Next in Thread]