diff options
| author | Mistivia <i@mistivia.com> | 2025-06-27 21:21:42 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-06-27 21:21:42 +0800 |
| commit | 878a056f3accafaa797446eb3a3b1a66b36d0d07 (patch) | |
| tree | f56330127b96bdff11f2bd37b7229a94d02fcacc /src/interp.c | |
| parent | 0ba662762023b7e3788690d9990ab39e89fd6f34 (diff) | |
add more funcs
Diffstat (limited to 'src/interp.c')
| -rw-r--r-- | src/interp.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/interp.c b/src/interp.c index 5a4c9b6..e6e9f2a 100644 --- a/src/interp.c +++ b/src/interp.c @@ -215,6 +215,12 @@ void Interp_init(Interp *self) { Interp_add_userfunc(self, "alphabetic?", builtin_alphabeticp); Interp_add_userfunc(self, "numeric?", builtin_numericp); Interp_add_userfunc(self, "alphanum?", builtin_alphanump); + Interp_add_userfunc(self, "set-nth", builtin_setnth); + Interp_add_userfunc(self, "set-nthcdr", builtin_setnthcdr); + Interp_add_userfunc(self, "foldl", builtin_foldl); + Interp_add_userfunc(self, "append", builtin_append); + Interp_add_userfunc(self, "nconc", builtin_nconc); + Interp_add_userfunc(self, "logand", builtin_logand); Interp_add_userfunc(self, "_gcstat", builtin_gcstat); Interp_add_userfunc(self, "_alwaysgc", builtin_alwaysgc); @@ -752,6 +758,11 @@ SExpRef lisp_call(Interp *interp, SExpRef fn, SExpRef args) { POP_REG(); if (CTL_FL(ret)) break; } + if (VALTYPE(ret) == kBreakSignal + || VALTYPE(ret) == kContinueSignal + || VALTYPE(ret) == kReturnSignal) { + return new_error(interp, "call: unexpected control flow signal.\n"); + } return ret; } @@ -1062,3 +1073,10 @@ SExpRef new_primitive(Interp *interp, LispPrimitive val) { return ret; } +SExpRef new_list2(Interp *interp, SExpRef e1, SExpRef e2) { + return CONS(e1, CONS(e2, NIL)); +} +SExpRef new_list3(Interp *interp, SExpRef e1, SExpRef e2, SExpRef e3); +SExpRef new_list4(Interp *interp, SExpRef e1, SExpRef e2, SExpRef e3, SExpRef e4); +SExpRef new_list5(Interp *interp, SExpRef e1, SExpRef e2, SExpRef e3, SExpRef e4, SExpRef e5); + |
