2018-11-04 11:06:09 +00:00
|
|
|
import java.lang.Integer;
|
|
|
|
|
2024-03-14 12:50:56 +00:00
|
|
|
public class Y {
|
2018-11-04 11:06:09 +00:00
|
|
|
y;
|
|
|
|
//factorial;
|
|
|
|
|
2024-03-14 12:50:56 +00:00
|
|
|
public Y() {
|
2018-11-04 11:06:09 +00:00
|
|
|
y = f -> t -> f.apply(y.apply(f)).apply(t);
|
|
|
|
//factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); });
|
|
|
|
}
|
2019-10-22 14:44:38 +00:00
|
|
|
/*
|
2019-09-19 11:57:49 +00:00
|
|
|
getY() {
|
|
|
|
return y;
|
|
|
|
}
|
2019-10-22 14:44:38 +00:00
|
|
|
*/
|
2018-11-04 11:06:09 +00:00
|
|
|
}
|
2019-10-22 14:44:38 +00:00
|
|
|
/*
|
2019-09-19 11:57:49 +00:00
|
|
|
class fac1 {
|
|
|
|
factorial;
|
|
|
|
|
|
|
|
fac1() {
|
|
|
|
var y;
|
|
|
|
y = new Y<Integer,Integer,Integer,Integer,Integer>().getY();
|
|
|
|
factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); });
|
|
|
|
}
|
|
|
|
}
|
2019-10-22 14:44:38 +00:00
|
|
|
|
2018-11-04 11:06:09 +00:00
|
|
|
ergibt Parse-Error
|
|
|
|
class fac1 {
|
|
|
|
factorial;
|
|
|
|
|
|
|
|
fac1() {
|
|
|
|
var y;
|
|
|
|
y = new Y<>().y;
|
|
|
|
factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); });
|
|
|
|
}
|
|
|
|
public static void main(String args[]) {
|
|
|
|
System.out.println(new fac1().factorial.apply(3));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
*/
|