- From: Christian Grün <cg@basex.org>
- Date: Wed, 2 Dec 2020 16:04:56 +0100
- To: Benito van der Zander <benito@benibela.de>
- Cc: Michael Kay <mike@saxonica.com>, public-xslt-40@w3.org
Hi Benito, > Have we forgotten about the last() function? It can do these things rather simple and is also shorter: True, fn:last can help. Unfortunately, it works different to fn:head(), and other languages (such as Lisp or Haskell) have counterparts for head and tail as well. Positional tests in predicates and fn:last won’t help us, for example, if we chain functions or pass on functions as items. > Elsewhere I had proposed to allow sequences of numbers in filter expressions, then one could also write even shorter $seq[1 to last() - 1] I also think this would have been a nice decision in earlier years. If I remember correctly, MarkLogic supported this as proprietary extension. > Look at this lizard 🦎: > First comes the head, then two feet and then the tail. ;) Somewhat true. On the other hand, if you subtract a head from a body, it may depend on both the perspective and the species if you want to regard the remaining leftovers as tail. I liked the fn:foot and fn:truncate proposals, but maybe there are better names (Haskell uses "init" instead of "truncate"… but I assume their main motivation was the character length). Cheers, Christian
Received on Wednesday, 2 December 2020 15:05:21 UTC