tisp

tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | LICENSE

commit 0734630a14a3a3a32162968166e26056f472bb4d
parent bc04d4d832065ddaa08054e92e0d272e006cdeeb
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Fri, 27 Mar 2020 20:01:11 -0700

Compare functions and macros for equality

Diffstat:
tisp.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tisp.c b/tisp.c @@ -179,7 +179,11 @@ vals_eq(Val a, Val b) return 0; if (a->t == PAIR) /* PAIR */ return vals_eq(car(a), car(b)) && vals_eq(cdr(a), cdr(b)); - if (a != b) /* PROCEDUREs, STRING, SYMBOL, NIL, VOID */ + /* TODO function var names should not matter in comparison */ + if (a->t & (FUNCTION | MACRO)) /* FUNCTION, MACRO */ + return vals_eq(a->v.f.args, b->v.f.args) && + vals_eq(a->v.f.body, b->v.f.body); + if (a != b) /* PRIMITIVE, STRING, SYMBOL, NIL, VOID */ return 0; return 1; }