Re: New Functions

> I am having a hard time following the different suggestions and merging
> them mentally, aren't tuples supposed to have a field name in any case
> as they are just specialized maps?
>  https://www.saxonica.com/qt4specs/XP/xpath-40-diff.html#id-tuple-test
<https://www.saxonica.com/qt4specs/XP/xpath-40-diff.html#id-tuple-test>
>
> That tuple of N things looks just like an array of (N) things to me.

Good question, @Martin Honnen <Martin.Honnen@gmx.de> !

As tuples are something new, I also can't go into details. Seems I misread
the syntax of TupleTest in
https://www.saxonica.com/qt4specs/XP/xpath-40-diff.html#id-grammar

Let me re-write:

 fn:partition-at($seq as item()*,
                      $n as xs:integer)
         as tuple(first ? item()*, second ? item()*)

@Michael Kay <mike@saxonica.com> Could you confirm that this is now correct?

Thanks,
Dimitre

On Mon, Nov 30, 2020 at 1:36 AM Martin Honnen <martin.honnen@gmx.de> wrote:

> Am 29.11.2020 um 23:53 schrieb Dimitre Novatchev:
> > Now that we have thetuple/ record type, we can have some very useful
> > functions on collections (both sequences and arrays) that return more
> > than one result,
> > or to say it in other words, return a tuple of Nthings, whereN > 1.
> >
> > fn:partition-at($seq as item()*,
> >
> >                  $n as xs:integer)
> >
> >         as tuple(item()*, item()*)
>
> I am having a hard time following the different suggestions and merging
> them mentally, aren't tuples supposed to have a field name in any case
> as they are just specialized maps?
> https://www.saxonica.com/qt4specs/XP/xpath-40-diff.html#id-tuple-test
>
> That tuple of N things looks just like an array of (N) things to me.
>
> >
> > , returns a tuple of two sequences, the first of which is
> >
> > subsequence($seq, 1, $n), and the second is:
> >
> > subsequence($seq, $n +1)
> >
>
> Or how would one access a the first and second field in the result of
> fn:partition-at($seq, $n)?
>
>
>
>
>
>

Received on Monday, 30 November 2020 15:20:51 UTC