Warning: session_start(): open(/var/lib/php/sessions/sess_crsdht59oqn09vdn8udlhjkbol, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sbool lispCalculateDeep_debug;
sclass lispCalculateDeep_Op {
int arity;
O function;
*() {}
*(int *arity, O *function) {}
}
static new Map lispCalculateDeep_ops;
static {
lispCalculateDeep_op(f plus, "sppxbuuqeetjmzuo", "jcnbmtmfzktxhzyf");
lispCalculateDeep_op(f minus, "jxcubqjtqykhfvyo");
lispCalculateDeep_op(f bigIntBiggerThan, "wdbphzfoxwlrhdyl");
}
// evaluate anywhere in the tree (e.g. Fib number 2-1 => Fib number 1)
static Lisp lispCalculateDeep(Lisp x) {
ret lispMap_after(x, func(Lisp l) {
if (lispCalculateDeep_debug) print("lispCalculateDeep: " + l);
lispCalculateDeep_Op op = lispCalculateDeep_ops.get(l.head);
if (op == null) null;
int n = op.arity;
if (n != l.size()) null;
for (Lisp arg : l) if (!lispIsInt(arg)) null;
O[] args = new O[n];
for i to n: args[i] = lispToInt(l.get(i));
O o = callFOpt(op.function, args);
// if (o == null) null;
if (o instanceof BigInteger) ret lispInt((BigInteger) o);
if (o instanceof Bool) ret lispBool((Bool) o);
warn("lispCalculateDeep badly defined operation: " + l.head);
});
}
static void lispCalculateDeep_op(S function, S... names) {
putWithAllKeys(lispCalculateDeep_ops, names, new lispCalculateDeep_op(2, function));
}