Expected distribution of lambda sizes (Re: Syntax poll, take 2)

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Jun 15 08:37:52 PDT 2011


On 15/06/11 16:00, John Nilsson wrote:
> On Wed, Jun 15, 2011 at 4:13 PM, Maurizio Cimadamore
> <maurizio.cimadamore at oracle.com>  wrote:
>> <T, V extends Comparable<T>>  List<V>  schwarz(List<T>  x, Function<T,
>> Pair<T,V>>  f) {
>>        return map(#{ w ->  f.apply(w) }, x)
>>           .sort( Pair<T,V>#fst() )
>>           .map( Pair<T,V>#snd() );
>>     }
> Could this become the following even?
>
> <T, V extends Comparable<T>>
> List<V>  schwarz(List<T>  x, Function<T,Pair<T,V>>  f) {
>        return x.map(f).sort(#fst).map(#snd);
>     }
I see where you are headed, you want to use the target type in order to 
infer the receiver type of the method reference; while this seems a nice 
idea in principle, a problem I see with this is the potential ambiguity 
with this#foo (which people might want to be able to shorten to just #foo).

Maurizio
>
> BR,
> John



More information about the lambda-dev mailing list