aboutsummaryrefslogtreecommitdiff
path: root/src/interp.c
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-06-22 17:23:32 +0800
committerMistivia <i@mistivia.com>2025-06-22 17:23:49 +0800
commit47c8353366c5cd7544d182a897bacaa303c08d8e (patch)
treed5362488aae5baba2afc3884d5339a09f182eaf9 /src/interp.c
parent5c0eddbed7f838daac17e0b9d9c2a23f17da4660 (diff)
math functions
Diffstat (limited to 'src/interp.c')
-rw-r--r--src/interp.c61
1 files changed, 41 insertions, 20 deletions
diff --git a/src/interp.c b/src/interp.c
index 8813d37..a8c9ad7 100644
--- a/src/interp.c
+++ b/src/interp.c
@@ -86,33 +86,54 @@ void Interp_init(Interp *self) {
Interp_add_primitive(self, "assert-error", primitive_assert_error);
Interp_add_primitive(self, "load", primitive_load);
- Interp_add_userfunc(self, "min", builtin_min);
- Interp_add_userfunc(self, "max", builtin_max);
+ Interp_add_userfunc(self, "round", builtin_round);
+ Interp_add_userfunc(self, "acos", builtin_acos);
+ Interp_add_userfunc(self, "floor", builtin_floor);
+ Interp_add_userfunc(self, "asin", builtin_asin);
+ Interp_add_userfunc(self, "log2", builtin_log2);
+ Interp_add_userfunc(self, "pow", builtin_pow);
+ Interp_add_userfunc(self, "float", builtin_float);
Interp_add_userfunc(self, "eq", builtin_eq);
- Interp_add_userfunc(self, "equal", builtin_equal);
- Interp_add_userfunc(self, "format", builtin_format);
+ Interp_add_userfunc(self, "ln", builtin_ln);
+ Interp_add_userfunc(self, "=", builtin_num_equal);
+ Interp_add_userfunc(self, "/=", builtin_num_neq);
Interp_add_userfunc(self, "concat", builtin_concat);
- Interp_add_userfunc(self, "error", builtin_error);
Interp_add_userfunc(self, "print", builtin_print);
- Interp_add_userfunc(self, "princ", builtin_princ);
- Interp_add_userfunc(self, "car", builtin_car);
- Interp_add_userfunc(self, "list", builtin_list);
- Interp_add_userfunc(self, "cdr", builtin_cdr);
- Interp_add_userfunc(self, "cons", builtin_cons);
- Interp_add_userfunc(self, "+", builtin_add);
+ Interp_add_userfunc(self, "format", builtin_format);
+ Interp_add_userfunc(self, "truncate", builtin_truncate);
+ Interp_add_userfunc(self, "mod", builtin_mod);
+ Interp_add_userfunc(self, "i/", builtin_idiv);
Interp_add_userfunc(self, "-", builtin_sub);
+ Interp_add_userfunc(self, "abs", builtin_abs);
Interp_add_userfunc(self, "*", builtin_mul);
- Interp_add_userfunc(self, "/", builtin_div);
- Interp_add_userfunc(self, "i/", builtin_idiv);
- Interp_add_userfunc(self, "mod", builtin_mod);
- Interp_add_userfunc(self, "=", builtin_num_equal);
- Interp_add_userfunc(self, "/=", builtin_num_neq);
- Interp_add_userfunc(self, "<", builtin_lt);
+ Interp_add_userfunc(self, "tan", builtin_tan);
+ Interp_add_userfunc(self, "exp", builtin_exp);
+ Interp_add_userfunc(self, "log10", builtin_log10);
+ Interp_add_userfunc(self, "list", builtin_list);
+ Interp_add_userfunc(self, "car", builtin_car);
+ Interp_add_userfunc(self, "sin", builtin_sin);
+ Interp_add_userfunc(self, "max", builtin_max);
+ Interp_add_userfunc(self, "exit", builtin_exit);
+ Interp_add_userfunc(self, "not", builtin_not);
+ Interp_add_userfunc(self, "cos", builtin_cos);
+ Interp_add_userfunc(self, "<=", builtin_le);
+ Interp_add_userfunc(self, "princ", builtin_princ);
Interp_add_userfunc(self, ">", builtin_gt);
+ Interp_add_userfunc(self, "+", builtin_add);
+ Interp_add_userfunc(self, "equal", builtin_equal);
+ Interp_add_userfunc(self, "/", builtin_div);
+ Interp_add_userfunc(self, "atan", builtin_atan);
+ Interp_add_userfunc(self, "cons", builtin_cons);
+ Interp_add_userfunc(self, "cdr", builtin_cdr);
+ Interp_add_userfunc(self, "ceiling", builtin_ceiling);
+ Interp_add_userfunc(self, "min", builtin_min);
+ Interp_add_userfunc(self, "error", builtin_error);
Interp_add_userfunc(self, ">=", builtin_ge);
- Interp_add_userfunc(self, "<=", builtin_le);
- Interp_add_userfunc(self, "not", builtin_not);
- Interp_add_userfunc(self, "exit", builtin_exit);
+ Interp_add_userfunc(self, "<", builtin_lt);
+ Interp_add_userfunc(self, "sqrt", builtin_sqrt);
+ Interp_add_userfunc(self, "cbrt", builtin_cbrt);
+
+
Interp_add_userfunc(self, "_gcstat", builtin_gcstat);
SExpRef ret = Interp_eval_string(self, bamboo_lisp_prelude);