RE: ORA-FO-UNORDERED 15.1.15 fn:unordered

> 
> 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 UTC