diff options
| author | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2026-01-21 17:12:58 +0100 |
|---|---|---|
| committer | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2026-01-21 17:12:58 +0100 |
| commit | 77df6486f9ed77e38a554cdaa6e28bea348f4788 (patch) | |
| tree | 44cb40d830c6901c1e2aa88825a4603281875efa /lisp_api.h | |
| parent | a5484c8bf3ac4c85f40ba0be5df036ce171cdc04 (diff) | |
add primitive lazy-eval (STILL BROKEN!)
Diffstat (limited to 'lisp_api.h')
| -rw-r--r-- | lisp_api.h | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -18,7 +18,8 @@ typedef enum { VT_PAIR, VT_LAMBDA, VT_PROCEDURE, - VT_ERROR + VT_ERROR, + VT_THUNK } val_type; struct value { @@ -41,6 +42,11 @@ struct value { struct { value *(*fn) (env *, value *); } procedure; + struct { + value *expr; + value *cached; + env *env; + } thunk; } as; }; @@ -52,6 +58,8 @@ value *make_nil(); value *make_lambda(env *e, value *params, value *body); value *make_procedure(value *(*fn) (env *, value *)); value *make_error(const char *str); +value *make_thunk(env *e, value *expr); +value *force_thunk(value *v); value *cons(value *car, value *cdr); value *car(value *cons); value *cdr(value *cons); |
