42 lines
809 B
Plaintext
42 lines
809 B
Plaintext
|
import java.lang.Integer;
|
||
|
|
||
|
public class Y {
|
||
|
y;
|
||
|
//factorial;
|
||
|
|
||
|
public Y() {
|
||
|
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); });
|
||
|
}
|
||
|
/*
|
||
|
getY() {
|
||
|
return y;
|
||
|
}
|
||
|
*/
|
||
|
}
|
||
|
/*
|
||
|
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); });
|
||
|
}
|
||
|
}
|
||
|
|
||
|
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));
|
||
|
}
|
||
|
|
||
|
}
|
||
|
*/
|