JavaCompilerCore/resources/bytecode/javFiles/Y.jav

22 lines
482 B
Plaintext
Raw Normal View History

import java.lang.Integer;
2024-03-14 12:50:56 +00:00
public class Y {
y;
2024-03-14 12:50:56 +00:00
public Y() {
2024-08-06 10:42:09 +00:00
y = f -> t -> f.apply(y.apply(f)).apply(t);
}
}
2024-08-06 10:42:09 +00:00
public class Fac1 {
public factorial;
public Fac1() {
var y;
2024-08-06 10:42:09 +00:00
var tmp = new Y<>(); // TODO Having new Y<>().y on one line doesn't work, see FIXME in StatementGenerator
y = tmp.y;
factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); });
}
2024-08-06 10:42:09 +00:00
public fac(v) {
return factorial.apply(v);
}
2024-08-06 10:42:09 +00:00
}