mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated func/fift
- updated func/fift - updated liteclient/liteserver - bugfixes
This commit is contained in:
parent
d41ce55305
commit
acf16718e6
45 changed files with 1360 additions and 185 deletions
28
crypto/func/test/a11.fc
Normal file
28
crypto/func/test/a11.fc
Normal file
|
@ -0,0 +1,28 @@
|
|||
_ f(slice ds, int total_weight, int elect_at, cell frozen, int total_stakes, int cnt, cell credits, cell vdict, int elect) {
|
||||
return (ds, elect, credits);
|
||||
}
|
||||
|
||||
_ g(slice ds, int total_weight, int elect_at, cell frozen, int total_stakes, int cnt, cell credits, int elect) {
|
||||
return (ds, elect, credits);
|
||||
}
|
||||
|
||||
_ h(slice ds, int total_weight, int elect_at, cell frozen, int total_stakes, cell credits, int elect) {
|
||||
return (ds, elect, credits);
|
||||
}
|
||||
|
||||
_ h2(slice ds, int total_weight, int elect_at, cell frozen, int total_stakes, cell credits, int elect) {
|
||||
return (ds, credits, elect);
|
||||
}
|
||||
|
||||
_ h3(int pubkey, int adnl_addr, int stake, int tot_weight, tuple vinfo) {
|
||||
return (pubkey, tot_weight, stake, vinfo);
|
||||
}
|
||||
|
||||
_ z(int a, int b) {
|
||||
return (b, 0, a);
|
||||
}
|
||||
|
||||
_ z2(int a, int b) {
|
||||
return (0, a, b);
|
||||
}
|
||||
|
20
crypto/func/test/a6_5.fc
Normal file
20
crypto/func/test/a6_5.fc
Normal file
|
@ -0,0 +1,20 @@
|
|||
var twice(f, x) {
|
||||
return f (f x);
|
||||
}
|
||||
|
||||
_ sqr(x) {
|
||||
return x * x;
|
||||
}
|
||||
|
||||
var main(x) {
|
||||
var f = sqr;
|
||||
return twice(f, x) * f(x);
|
||||
}
|
||||
|
||||
var pow6(x) {
|
||||
return twice(sqr, x) * sqr(x);
|
||||
}
|
||||
|
||||
_ q() {
|
||||
return false;
|
||||
}
|
37
crypto/func/test/c1.fc
Normal file
37
crypto/func/test/c1.fc
Normal file
|
@ -0,0 +1,37 @@
|
|||
global int x, y, z;
|
||||
global (cell, slice) y;
|
||||
global ((int, int) -> int) op;
|
||||
|
||||
_ get() {
|
||||
var t = z + 1;
|
||||
return x;
|
||||
}
|
||||
|
||||
_ pre_next() {
|
||||
return x + 1;
|
||||
}
|
||||
|
||||
() init() impure {
|
||||
;; global x;
|
||||
x = 0;
|
||||
}
|
||||
|
||||
int next() impure {
|
||||
;; global x;
|
||||
return x += 1;
|
||||
}
|
||||
|
||||
_ set_y(x, w) {
|
||||
y = (w, x);
|
||||
}
|
||||
|
||||
_ get_y() impure {
|
||||
return y;
|
||||
}
|
||||
|
||||
int main(int c) {
|
||||
init();
|
||||
c += next();
|
||||
return c + pre_next();
|
||||
}
|
||||
|
10
crypto/func/test/c2.fc
Normal file
10
crypto/func/test/c2.fc
Normal file
|
@ -0,0 +1,10 @@
|
|||
global ((int, int) -> int) op;
|
||||
|
||||
int check_assoc(int a, int b, int c) {
|
||||
return op(op(a, b), c) == op(a, op(b, c));
|
||||
}
|
||||
|
||||
int main() {
|
||||
op = _+_;
|
||||
return check_assoc(2, 3, 9);
|
||||
}
|
7
crypto/func/test/c2_1.fc
Normal file
7
crypto/func/test/c2_1.fc
Normal file
|
@ -0,0 +1,7 @@
|
|||
_ check_assoc(op, a, b, c) {
|
||||
return op(op(a, b), c) == op(a, op(b, c));
|
||||
}
|
||||
|
||||
int main() {
|
||||
return check_assoc(_+_, 2, 3, 9);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue