@ -11,6 +11,10 @@ static Pointer run_fn(Func fn, Pointer params) {
env = cons(tbl, env);
while(args != NIL && params != NIL) {
if (CAR(args) == BODY && CAR(CDR(args)) != NIL) {
table_set(tbl, CAR(CDR(args)), params);
break;
}
table_set(tbl, CAR(args), CAR(params));
args = CDR(args);
params = CDR(params);
@ -325,6 +325,7 @@ void init(void) {
/*
(set-reader-macro \' (fn (s c) (list quote (read s))))
(defmacro defn (name args &body body) (list def name (cons fn (cons args body))))
*/
void repl(void) {
@ -113,6 +113,7 @@ extern Pointer UNDEFINED;
extern Pointer T;
extern Pointer STANDARD_INPUT;
extern Pointer STANDARD_OUTPUT;
extern Pointer BODY;
/** UTILS **/
void init(void);
@ -6,6 +6,7 @@ Pointer T;
Pointer STANDARD_INPUT;
Pointer STANDARD_OUTPUT;
Pointer UNDEFINED;
Pointer BODY;
static Pointer SYMBOLS;
@ -53,5 +54,6 @@ void symbol_init(void) {
STANDARD_INPUT = symbol1("*standard-input*");
STANDARD_OUTPUT = symbol1("*standard-output*");
UNDEFINED = symbol1("undefined");
BODY = symbol1("&body");