tisp

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

commit 3a1c16e8313997642507deb7e23bba1245bcf105
parent 0f6536a2239b52e23aeae5ac74c8e2b86139827d
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Wed, 18 Dec 2019 17:40:10 -0800

Only define values in local scope

Diffstat:
tisp.c | 5+----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tisp.c b/tisp.c @@ -926,7 +926,6 @@ static Val prim_define(Tsp st, Hash env, Val args) { Val sym, val; - Hash h; tsp_arg_min(args, "define", 2); if (car(args)->t == PAIR) { sym = caar(args); @@ -942,9 +941,7 @@ prim_define(Tsp st, Hash env, Val args) tsp_warn("define: incorrect format, no variable name found"); if (!val) return NULL; - /* last linked hash is global namespace */ - for (h = env; h->next; h = h->next) ; - hash_add(h, sym->v.s, val); + hash_add(env, sym->v.s, val); return st->none; }