Function Composition
Jed Wesley-Smith
jed at wesleysmith.io
Tue Jan 1 15:40:26 PST 2013
hello lambdarians!
Just noticed that the java.util.function.Function.compose method is
round the wrong way (according to the common definition of function
composition*).
The current lambda definition:
http://hg.openjdk.java.net/lambda/lambda/jdk/file/858e2f478d62/src/share/classes/java/util/function/Function.java
has f.compose(g) mean apply f and then apply g, whereas the usual
(most other languages and the literature) has f ∘ g mean apply g and
then apply f.
The form that Function has currently is commonly known as andThen. So,
you could rename the current method andThen and add a new compose
method that works in the usual manner.
cheers,
jed.
* references:
http://en.wikipedia.org/wiki/Function_composition
http://en.wikipedia.org/wiki/Function_composition_(computer_science)
More information about the lambda-dev
mailing list