This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
XQuery 3.1 introduces the arrow operator to apply a function to an item in a much more readable way. In the same spirit, I would like to apply a function to items in a sequence in such a nice and easily readable way. Suppose, we have a sequence ("a", "b", "c") and we want to get a sequence of upper-case letters as a result. So using the ! operator we can get each item in the sequence and using the arrow operator we can apply the upper-case function. This will result in the following code: ("a", "b", "c") ! (. => upper-case()) which isn't really easier readable anymore because of the required parenthesis. It would be much nicer if we could add an operator, lets say ==>, which would apply the function for each item in the sequence, so we would simply write: ("a", "b", "c") ==> upper-case() This gets even more relevant if the expression is longer. Lets take the example from the spec for the arrow operator at https://www.w3.org/TR/2014/WD-xquery-31-20140424/#id-arrow-operator: tokenize((normalize-unicode(upper-case($string))),"\s+") Suppose, instead of a $string we have a $sequence. Currently, we would have to write: $item ! (. =>upper-case()=>normalize-unicode()=>tokenize("\s+")) With a new operator this would change to $item==>upper-case()=>normalize-unicode()=>tokenize("\s+") which removes difficult to read and nested parenthesis. So to sum up, this double arrow operator is a postfix operator that applies a function to each item in a seuqnece, using each item as the first argument to the function.] If $s is a sequence and f() is a function, then $s==>f() is equivalent to $s ! f(.) or $s ! (. => f())
I'm moving this to 3.2 (future versions). It's too late for the current CR.
There's always ("a", "b", "c") => for-each(uppercase#1)