[xquery-talk] arrow operator

Graydon Saunders graydonish at gmail.com
Wed Aug 2 05:32:27 PDT 2017


The thing that convinced me I cared about the arrow operator was

(//@someFlag) => distinct-values()

since there's no other way to avoid having to make whatever lump of logic
is really there for //@someFlag the explicit operand of the
distinct-values() and I often find I want to test that the lump of logic
returns the kind and number of thing I expect before reducing the sequence
to its distinct values.  Using the arrow operator results in something
that's much nicer to read.

On Tue, Aug 1, 2017 at 12:58 PM, Michael Kay <mike at saxonica.com> wrote:

> In the case of singletons there's very little difference, but (as I now
> see Christian has pointed out), with sequences the effect is quite
> different.
>
> Also, of course, "!" changes the context item, so
>
> @address => replace(@postcode, "", "q") works, while
>
> @address ! replace(@postcode, "", "q") doesn't.
>
> Michael Kay
> Saxonica
>
> > On 1 Aug 2017, at 13:27, W.S. Hager <wshager at gmail.com> wrote:
> >
> > Hi,
> >
> > Is there any advantage to using the 3.1 arrow operator over the simple
> map operator?
> >
> > $string => upper-case() => normalize-unicode() => tokenize("\s+")
> >
> > versus
> >
> > $string ! upper-case(.) ! normalize-unicode(.) ! tokenize(.,"\s+")
> >
> > Thanks,
> > Wouter
> > _______________________________________________
> > talk at x-query.com
> > http://x-query.com/mailman/listinfo/talk
>
>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://x-query.com/pipermail/talk/attachments/20170802/169d878f/attachment.html>


More information about the talk mailing list