mirror of
https://github.com/danog/ton.git
synced 2024-12-04 02:18:00 +01:00
131 lines
1.7 KiB
Plaintext
131 lines
1.7 KiB
Plaintext
var f(a, b, c, d, e, f) {
|
|
var D = a * d - b * c;
|
|
var Dx = e * d - b * f;
|
|
var Dy = a * f - e * c;
|
|
return (Dx / D, Dy / D);
|
|
}
|
|
|
|
var test8() {
|
|
return -4;
|
|
}
|
|
|
|
var test3(a) {
|
|
int x = a * 10;
|
|
a += 1;
|
|
int x = x + 3;
|
|
{
|
|
int y = x + 2;
|
|
x = y + a;
|
|
}
|
|
int z = 5;
|
|
return x * (z + a);
|
|
}
|
|
|
|
var test2(a) {
|
|
(var x, var y) = a /% 10;
|
|
return x + y;
|
|
}
|
|
|
|
var test2a(a) {
|
|
var (x, y) = a /% 10;
|
|
return x + y;
|
|
}
|
|
|
|
var test2b(a) {
|
|
var z = a /% 10;
|
|
return _+_ z;
|
|
}
|
|
|
|
var test2c(a) {
|
|
return _+_ (a /% 10);
|
|
}
|
|
|
|
var twice(f, x) {
|
|
return f (f x);
|
|
}
|
|
|
|
var test() {
|
|
return f(1, 2, 3, 4, 7, 17);
|
|
}
|
|
|
|
var rot(a, b, c) {
|
|
return (b, c, a);
|
|
}
|
|
|
|
var rot_int(int a, int b, int c) {
|
|
return (b, c, a);
|
|
}
|
|
|
|
(int, _) dup_int(x) {
|
|
return (x, x);
|
|
}
|
|
|
|
var calc_phi() {
|
|
var n = 10;
|
|
n *= n;
|
|
n *= n;
|
|
n *= n;
|
|
n *= n;
|
|
n *= n;
|
|
n *= n;
|
|
var p = var q = 1;
|
|
(p, q) = (q, p + q);
|
|
(p, q) = (q, p + q);
|
|
(p, q) = (q, p + q);
|
|
(p, q) = (q, p + q);
|
|
(p, q) = (q, p + q);
|
|
(p, q) = (q, p + q);
|
|
(p, q) = (q, p + q);
|
|
return muldivr(p, n, q);
|
|
}
|
|
|
|
var t0() {
|
|
var x = 1;
|
|
return x;
|
|
}
|
|
|
|
var t1() {
|
|
return 2;
|
|
}
|
|
|
|
var t2(int x) {
|
|
return 2;
|
|
return x += 1;
|
|
}
|
|
|
|
var t3(int x, var y) {
|
|
int z = (x + y) * (x - y);
|
|
}
|
|
|
|
var t3b(int x, var y) {
|
|
int z = (x + y) * (x - y);
|
|
return z;
|
|
}
|
|
|
|
var t4((int, int, int) z) {
|
|
var (_, u, _) = z;
|
|
return u;
|
|
}
|
|
|
|
int foo(int t);
|
|
|
|
var t5(x) {
|
|
var f = t2;
|
|
return twice(f, x) * f(x);
|
|
}
|
|
|
|
var proj1(a, b) { return a; }
|
|
var proj1a(a, b) { var c = a; return c; }
|
|
var proj1b(a, b) { int c = a; return c; }
|
|
var proj1c(a, b) { var c = a + 2; return c; }
|
|
var proj1d(a, b) { return a + 2; }
|
|
var proj1e(int a, _) { return a; }
|
|
int proj1f(_ a, int) { return a; }
|
|
int proj1g(int, a) { return a; }
|
|
|
|
var test1(a) {
|
|
a = a + 1;
|
|
return a;
|
|
}
|
|
|