Added Java implementation#1
Open
CptNeemoo wants to merge 1 commit intoHowProgrammingWorks:masterfrom
CptNeemoo:master
Open
Added Java implementation#1CptNeemoo wants to merge 1 commit intoHowProgrammingWorks:masterfrom CptNeemoo:master
CptNeemoo wants to merge 1 commit intoHowProgrammingWorks:masterfrom
CptNeemoo:master
Conversation
Added Java implementation
lidaamber
requested changes
Jun 7, 2017
lidaamber
left a comment
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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) | ||
| { |
| 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); |
| 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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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>{ |
tshemsedinov
reviewed
Jun 7, 2017
| # IntelliJ | ||
| /out/ | ||
| /.idea | ||
| *.iml No newline at end of file |
Member
There was a problem hiding this comment.
Add extra line break at EOL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added Java implementation by Serhii Frolov IT-42