2023-11-12 14:03:39 +00:00
|
|
|
defun aaa(a b) {
|
|
|
|
| c |
|
|
|
|
set c (+ a b);
|
|
|
|
return c;
|
|
|
|
};
|
|
|
|
|
|
|
|
set k (aaa 10 20);
|
|
|
|
|
2024-01-18 10:16:05 +00:00
|
|
|
if (= k 30) {
|
|
|
|
printf "OK - %d\n" k;
|
|
|
|
} else {
|
|
|
|
printf "ERROR - %d\n" k;
|
|
|
|
};
|
2023-11-12 14:03:39 +00:00
|
|
|
|
2023-11-14 03:20:47 +00:00
|
|
|
## --------------------------------------
|
2023-11-12 14:03:39 +00:00
|
|
|
|
2023-11-14 03:20:47 +00:00
|
|
|
defun mkfun(t) {
|
|
|
|
return (fun(c) {
|
|
|
|
return (+ t c);
|
|
|
|
});
|
|
|
|
};
|
2023-11-12 14:03:39 +00:00
|
|
|
|
2023-11-14 03:20:47 +00:00
|
|
|
set f (mkfun 20);
|
|
|
|
set k (f 50);
|
2024-01-18 10:16:05 +00:00
|
|
|
if (= k 70) {
|
|
|
|
printf "OK - %d\n" k;
|
|
|
|
} else {
|
|
|
|
printf "ERROR - %d\n" k;
|
|
|
|
};
|
2023-11-15 00:58:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
## --------------------------------------
|
|
|
|
|
2024-01-18 10:16:05 +00:00
|
|
|
defclass A | a b c | {
|
2023-11-15 00:58:02 +00:00
|
|
|
defun ::* newInstance(x y z) {
|
|
|
|
(set a x)
|
|
|
|
(set b y)
|
|
|
|
(set c z)
|
|
|
|
(return self)
|
|
|
|
};
|
|
|
|
|
|
|
|
defun get-a() { return a; };
|
|
|
|
##defun get-b() b;
|
|
|
|
##defun get-c() c;
|
|
|
|
};
|
|
|
|
|
2024-01-01 16:41:41 +00:00
|
|
|
set k (A:newInstance 11 22 33);
|
|
|
|
set v (k:get-a);
|
2024-01-18 10:16:05 +00:00
|
|
|
if (= v 11) {
|
|
|
|
printf "OK - %d\n" v;
|
|
|
|
} else {
|
|
|
|
printf "ERROR - %d\n" v;
|
|
|
|
};
|