diff options
| author | Keith Packard <keithp@keithp.com> | 2017-12-01 15:40:23 -0600 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2017-12-01 15:40:23 -0600 | 
| commit | c31744299e5a4342bbe26d3735ee2d8f09192ae9 (patch) | |
| tree | 108153f1d01c56800d6e4dc0c56dbcce979717be /src/lisp/ao_lisp_make_const.c | |
| parent | 98923ae1189f062b8b94120d47a56892db25493f (diff) | |
altos/lisp: split set/def. Add def support to lambdas
In scheme, set can only re-define existing variables while def cannot
redefine existing variables in lambda context. Def within lambda
creates a new variable at the nearest enclosing scope.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lisp/ao_lisp_make_const.c')
| -rw-r--r-- | src/lisp/ao_lisp_make_const.c | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/src/lisp/ao_lisp_make_const.c b/src/lisp/ao_lisp_make_const.c index f9bb5452..f3ea6be0 100644 --- a/src/lisp/ao_lisp_make_const.c +++ b/src/lisp/ao_lisp_make_const.c @@ -133,7 +133,7 @@ ao_has_macro(ao_poly p);  ao_poly  ao_macro_test_get(ao_poly atom)  { -	ao_poly	*ref = ao_lisp_atom_ref(ao_lisp_frame_global, atom); +	ao_poly	*ref = ao_lisp_atom_ref(atom);  	if (ref)  		return *ref;  	return AO_LISP_NIL; @@ -289,6 +289,8 @@ main(int argc, char **argv)  		}  	} +	ao_lisp_frame_init(); +  	/* Boolean values #f and #t */  	ao_lisp_bool_get(0);  	ao_lisp_bool_get(1); @@ -298,13 +300,13 @@ main(int argc, char **argv)  		if (funcs[f].func != prev_func)  			b = ao_lisp_make_builtin(funcs[f].func, funcs[f].args);  		a = ao_lisp_atom_intern(funcs[f].name); -		ao_lisp_atom_set(ao_lisp_atom_poly(a), +		ao_lisp_atom_def(ao_lisp_atom_poly(a),  				 ao_lisp_builtin_poly(b));  	}  	/* end of file value */  	a = ao_lisp_atom_intern("eof"); -	ao_lisp_atom_set(ao_lisp_atom_poly(a), +	ao_lisp_atom_def(ao_lisp_atom_poly(a),  			 ao_lisp_atom_poly(a));  	/* 'else' */ | 
