Re: Types and Generics

I've wondered about this; and internally, at a very simple level, Saxon does have something a bit like this where we know, for example, that the result of fn:reverse is the same type as the input. But a fully worked specification (including, in particular, all the type subsumption rules) is something that I don't have the energy (or probably the brain-power) for.

Michael Kay
Saxonica

> On 30 Nov 2020, at 01:30, Dimitre Novatchev <dnovatchev@gmail.com> wrote:
> 
> 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 10:48:19 UTC