Method References and partial application

John Nilsson john at milsson.nu
Sat Jun 25 09:27:25 PDT 2011


There could be an argument made for point free expressions being more
abstract and thus allowing higher level reasoning.

On the other hand this would be more important for lambda combinators such
as kleisli composition and friends. Without function types and higher order
generics this style of programming might not be that useful though.

BR,
John

Sent from my phone
Den 25 jun 2011 18:19 skrev "Dan Smith" <daniel.smith at oracle.com>:
> Method references are still pretty unstable in their design. This isn't a
feature we've been considering recently, though.
>
> My thinking is that, for anything more complex than just using a method
as-is, a lambda expression is a completely reasonable fall-back. Is there a
reason that is not the case here?
>
> SAM2 sam2 = Test#multiply;
> SAM1 sam1 = { x -> Test.multiply(10,x) };
> SAM0 sam0 = { -> Test.multiply(10,20) };
> SAM0 sam00 = { -> sam1.apply(20) };
>
> (If the compiler wants to recognize this pattern and optimize it in some
way, all the better.)
>
> —Dan
>
> On Jun 25, 2011, at 4:38 AM, Ali Ebrahimi wrote:
>
>> Hi Brian,
>> Is partial application Support for Method References in current scope?
>>
>> class Test{
>> public static int multiply(int x, int y){ return x * y;}
>>
>> public static void main(String... args){
>> SAM2 sam2 = Test#multiply;
>> SAM1 sam1 = Test#multiply(10,int);
>> SAM0 sam0 = Test#multiply(10,20);
>> SAM0 sam00 = sam1#apply(20);
>> }
>> }
>>
>> Best Regards,
>> Ali Ebrahimi
>>
>
>


More information about the lambda-dev mailing list