+1 for X => map:for-each(A, ?) meaning map:for-each(A, X)
Jim Fuller On Sun, Jan 10, 2016 at 11:03 PM, Adam Retter <[email protected]> wrote: > Thanks Mike, that is exactly the kinda detail I needed, and the bug > report has many good comments. > > Personally I do like the idea and syntax from an XQuery authoring > perspective of being able to do: > > X => map:for-each(A, ?) meaning map:for-each(A, X) > > However, I am not precious about it. So whichever way it is decided, > as long as the spec defines, I will be both happy and informed ;-) > > Thanks again. Adam. > > On 10 January 2016 at 21:51, Michael Kay <[email protected]> wrote: > > There's an open bug against the spec on the use of ?-placeholders in > conjunction with the arrow operator. > > > > https://www.w3.org/Bugs/Public/show_bug.cgi?id=29346 > > > > The grammar allows it, but the semantics have not been specified. > > > > My own view is that > > > > X => map:for-each(A, ?) > > > > should mean > > > > map:for-each(X, A, ?) > > > > which is an error because there are too many arguments. > > > > But we need to await the WG decision on this bug. > > > > Michael Kay > > Saxonica > > > > > >> On 10 Jan 2016, at 19:30, Adam Retter <[email protected]> > wrote: > >> > >> Given this valid XQuery (1): > >> > >> map:for-each( > >> map { > >> "a" : "1", > >> "b" : "2", > >> "c" : "3" > >> }, > >> ? > >> )(function($k, $v) { > >> "$k=" || $k > >> }) > >> > >> I am wondering, if rewriting it to the following form results in a > >> valid query with the same execution result (2): > >> > >> function($k, $v) { > >> "$k=" || $k > >> } => > >> map:for-each( > >> map { > >> "a" : "1", > >> "b" : "2", > >> "c" : "3" > >> }, > >> ? > >> )() > >> > >> In my mind it does, however I can't find a current implementation > >> (eXist, BaseX, Saxon-EE) which will execute it, I guess this is due to > >> evaluation order of the expressions (although I get parser errors). > >> > >> If I add some brackets to (2), to add precedence to the evaluation > >> order so that I have (3): > >> > >> function($k, $v) { > >> "$k=" || $k > >> } => > >> ( > >> map:for-each( > >> map { > >> "a" : "1", > >> "b" : "2", > >> "c" : "3" > >> }, > >> ? > >> ))() > >> > >> > >> Then it does seem to execute on BaseX and Saxon, but it feels like I > >> shouldn't need to add the brackets and that (2) should work! Can > >> someone add some comment/insight for me as to whether the XQuery spec > >> requires these brackets to make the parse and execution correct? > >> Somehow, I can't see it at the moment... > >> > >> > >> Thanks Adam. > >> > >> -- > >> Adam Retter > >> > >> skype: adam.retter > >> tweet: adamretter > >> http://www.adamretter.org.uk > >> _______________________________________________ > >> [email protected] > >> http://x-query.com/mailman/listinfo/talk > > > > > > > > -- > Adam Retter > > skype: adam.retter > tweet: adamretter > http://www.adamretter.org.uk > _______________________________________________ > [email protected] > http://x-query.com/mailman/listinfo/talk >
_______________________________________________ [email protected] http://x-query.com/mailman/listinfo/talk
