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

John Nilsson john at milsson.nu
Wed Jun 15 08:00:08 PDT 2011


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);
   }


BR,
John


More information about the lambda-dev mailing list