Why is there no notation for function application?

Millies, Sebastian Sebastian.Millies at softwareag.com
Tue Sep 17 07:43:33 PDT 2013

Hello there,

just out of curiosity: why has no general notation for function application been introduced
together with lambda expressions? Or in other words: Since there is always exactly one abstract
method in the type inferred for a lambda expression, why should I still be forced to type that
out myself?

E. g. in

Function<T, Function<U,R>> curry(BiFunction<T,U,R> f) {
   return (T t) -> (U u) -> f.apply(t, u);

It would be so much nicer to be able to simply write (T t) -> (U u) -> f(t, u)
More involved lambdas would profit even more, e. g.

Function<U,R> partial(Function<T, Function<U,R>> f, T t) {
  return u -> f (t)(u);

For what reason has this been decided against? (Of course, if I wanted to invoke another
method on the reference in question, I’d still have to say so, but that wouldn’t detract from the
utility of the shorter notation in the particular case.)

n  Sebastian

Software AG – Sitz/Registered office: Uhlandstraße 12, 64297 Darmstadt, Germany – Registergericht/Commercial register: Darmstadt HRB 1562 - Vorstand/Management Board: Karl-Heinz Streibich (Vorsitzender/Chairman), Dr. Wolfram Jost, Arnd Zinnhardt; - Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Dr. Andreas Bereczky - http://www.softwareag.com

More information about the lambda-dev mailing list