Types and Generics

Isn't it time to introduce generics?



fn:group-by($seq as $$T*,

            $fun as function($arg as $$T  ) as $$V)
        as map($$V, $$T+)

Applies $fun on each of the items in $seq and groups the results by value,
in a  map with an entry for each distinct produced value $v  (as key) and
value - the sequence of all items $it in $seq such that $fun($it) eq $v



Thanks,

Dimitre

Received on Monday, 30 November 2020 01:31:22 UTC