- From: Dimitre Novatchev <dnovatchev@gmail.com>
- Date: Mon, 30 Nov 2020 07:52:57 -0800
- To: Michael Kay <mike@saxonica.com>, public-xslt-40@w3.org
- Message-ID: <CAK4KnZcMizkhfNtWbYyuBjAXKSsk-4-ee_T3NAeuD+2ctnGgPQ@mail.gmail.com>
> For 4.0 I'm proposing map:index($seq as item()*, $key as function(item()) as xs:anyAtomicType) which builds a map > whose keys are the distinct values of the grouping key computed using $key. > The proposed partition() function seems to be just a special case of that where the $key function returns boolean values. (Perhaps group-by would be a better name than index?) > > Michael Kay > Saxoniica +1 for "group-by" We need to be able to use a type variable (generics) instead of item() and xs:anyAtomicType . Thanks, Dimitre On Mon, Nov 30, 2020 at 7:40 AM Michael Kay <mike@saxonica.com> wrote: > > For a few good examples of the partition function in Haskell, see: > http://zvon.org/other/haskell/Outputlist/partition_f.html > > > > For 4.0 I'm proposing map:index($seq as item()*, $key as function(item()) > as xs:anyAtomicType) which builds a map whose keys are the distinct values > of the grouping key computed using $key. The proposed partition() function > seems to be just a special case of that where the $key function returns > boolean values. (Perhaps group-by would be a better name than index?) > > Michael Kay > Saxoniica > > -- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- Never fight an inanimate object ------------------------------------- To avoid situations in which you might make mistakes may be the biggest mistake of all ------------------------------------ Quality means doing it right when no one is looking. ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play ------------------------------------- To achieve the impossible dream, try going to sleep. ------------------------------------- Facts do not cease to exist because they are ignored. ------------------------------------- Typing monkeys will write all Shakespeare's works in 200yrs.Will they write all patents, too? :) ------------------------------------- Sanity is madness put to good use. ------------------------------------- I finally figured out the only reason to be alive is to enjoy it.
Received on Monday, 30 November 2020 15:53:26 UTC