W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2003

RE: ORA-FO-UNORDERED 15.1.15 fn:unordered

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Wed, 24 Sep 2003 16:49:24 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E62106073DD14B@daemsg02.software-ag.de>
To: Oliver Becker <obecker@informatik.hu-berlin.de>, public-qt-comments@w3.org
> 
> I'm sorry, but I don't understand what the *function* 
> fn:unordered really ought to do. 

Conceptually, fn:unordered returns an arbitrary permutation of its input
sequence.

In reality, it tells the optimizer that it needn't go to the trouble of
getting the input sequence in the right order, because the order isn't
needed. So it's a true function in terms of the formal semantics, but is
likely in practice to be treated as an optimization directive.

Consider the also discussed 
> distinct-values example.
> 
> <xsl:variable name="a" 
> select="distinct-values((1,2,3,2,1,2,3,2,1))" /> 
> <xsl:variable name="b" select="fn:unordered($a)" />
> 
> What are the values of $a and $b please?

Applying unordered() to the results of distinct-values() has no effect,
because the results are already in arbitrary order. The result is some
permutation of the sequence (1,2,3).
> 
> 
> By the way, I just noted the following:
> shouldn't the example of distinct-values uses the additional 
> pair of parentheses?
> 
> Instead of 
> fn:distinct-values(1, 2.0, 3, 2) returns something
> write
> fn:distinct-values((1, 2.0, 3, 2)) returns something
> 
Yes!

Michael Kay
Received on Wednesday, 24 September 2003 10:52:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:01 GMT