Skip to content

Conversation

CptNeemoo
Copy link

Added Java implementation by Serhii Frolov IT-42

Added Java implementation
@GYFK GYFK requested a review from lidaamber June 6, 2017 23:15
Copy link

@lidaamber lidaamber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job :)
Could you please add a few code style and formatting changes?

class Closure {

public static void main(String[] args) {
Function<Double,Function<Double,Double>> createLog = (Double base) -> (Double n) -> log(base, n);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code style. And could you split this line to fit 100 symbols in line, please? Just a code style suggestion.

}

private static Double log(Double base, Double n)
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code style.

public static void main(String[] args) {
final TriFunction<Integer,Integer,Integer,Integer> add = Curry::sum;
Function<Integer, Function<Integer, Function<Integer,Integer>>> uncurry = Curry.curry(add);
TriFunction<Integer,Integer,Integer,Integer> curry = Curry.uncurry(uncurry);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code formatting.

return a + b + c;
}

private static <A, B, C, D> Function<A, Function<B, Function<C,D>>> curry(final TriFunction<A, B, C, D> f) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you split this line to fit 100 symbols in line, please? Just a code style suggestion.

return (A a) -> (B b) -> (C c) -> f.apply(a, b, c);
}

private static <A, B, C, D> TriFunction<A,B,C,D> uncurry(Function<A, Function<B, Function<C, D>>> f) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you split this line to fit 100 symbols in line, please? Just a code style suggestion.

}

@FunctionalInterface
public interface TriFunction<A,B,C,D>{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code formatting.

# IntelliJ
/out/
/.idea
*.iml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add extra line break at EOL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants