16 lines
318 B
Plaintext
16 lines
318 B
Plaintext
int -> int fix(<int -> int> -> int -> int f) {
|
|
T -> int -> int g = fun(T x) { f(fun(int y) { x.f x y; }); };
|
|
g (new Y(f = g));
|
|
}
|
|
|
|
struct Y : T {
|
|
init T -> int -> int f;
|
|
}
|
|
|
|
int factorialor(int -> int factorial) (int x) {
|
|
if(x == 0) 1
|
|
else x * factorial(x - 1);
|
|
}
|
|
|
|
int main(int n) { fix factorialor n; }
|