Re: fn:foot, fn:truncate, fn:item-at

Thanks for the hint. I completely overlooked this new function.

I’ve probably become used too much to the semantics of XPath, so I was
surprised to see negative indexes as indicators for reverse lookups. I
cannot remember any other functions/operators in the X domain that
does something similar, and applying any combination with fn:reverse
would have been my intuitive choice. On the other hand, it may just be
my old habits, and the slice function may be well-known enough in the
Python or JavaScript community not to cause too much confusion. It’s
definitely better than expanding on the behavior of fn:subsequence for
negative integers, or even doubles.

If I could choose, I would be happy to see at least fn:truncate added
to the new spec, as the argument needs to be referenced twice with
slice. So we can’t write…

  (1 to 10) => fn:slice(1 to ...)

…and if we cannot use a function, we already have $seq[position() <
count($seq)]. Next, if we add fn:truncate, it may just be consistent
to add fn:foot, too ;)
____________________________________

On Wed, Dec 2, 2020 at 12:02 PM Michael Kay <mike@saxonica.com> wrote:
>
> The latest version allows
>
> slice($seq, -1)  to get the last item
>
> slice($seq, $N) to get the Nth item
>
> slice($seq, 1 to count($seq)-1) to get all but the last
>
> and I thought that was probably good enough to make the individual functions unnecessary.
>
> Would you agree?
>
> Michael Kay
> Saxonica
>
> On 2 Dec 2020, at 10:30, Christian Grün <cg@basex.org> wrote:
>
> Hi Michael,
>
> In your first public XQFO proposal [1], I have found seen three
> functions (fn:foot, fn:truncate, fn:item-at) that have not made it
> into the latest specification documents. Are you still working on it,
> or did you deliberately decide not to include them in the new draft?
>
> Thanks,
> Christian
>
> [1] https://www.saxonica.com/qt4specs/FO/Overview-diff.html
>
>

Received on Wednesday, 2 December 2020 12:30:27 UTC