Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -3,16 +3,7 @@ import java.util.function.Function;
|
|||
|
||||
public class FirstClass{
|
||||
|
||||
public static <A,B,C> Function<A, C> compose(
|
||||
final Function<B, C> f, final Function<A, B> g) {
|
||||
return new Function<A, C>() {
|
||||
@Override public C apply(A x) {
|
||||
return f.apply(g.apply(x));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
public static void main(String... arguments){
|
||||
ArrayList<Function<Double, Double>> functions = new ArrayList<>();
|
||||
|
||||
functions.add(Math::cos);
|
||||
|
|
@ -25,8 +16,8 @@ public class FirstClass{
|
|||
inverse.add(Math::atan);
|
||||
inverse.add(Math::sqrt);
|
||||
System.out.println("Compositions:");
|
||||
for(int i = 0; i < functions.size(); i++){
|
||||
System.out.println(compose(functions.get(i), inverse.get(i)).apply(0.5));
|
||||
for (int i = 0; i < functions.size(); i++){
|
||||
System.out.println(functions.get(i).compose(inverse.get(i)).apply(0.5));
|
||||
}
|
||||
System.out.println("Hard-coded compositions:");
|
||||
System.out.println(Math.cos(Math.acos(0.5)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue