diff options
author | Keith Packard <keithp@keithp.com> | 2017-11-16 17:49:47 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-11-16 18:40:31 -0800 |
commit | b3b4731fcb89cb404433f37a7704a503567c43bd (patch) | |
tree | 74f0a214725905c7556a735127f01a4b4b0926be /src/lisp/ao_lisp_eval.c | |
parent | bd881a5b85d7cd4fb82127f92f32e089499b50cb (diff) |
altos/lisp: Add scheme-style bools (#t and #f)
Cond and while compare against #f, just like scheme says to.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lisp/ao_lisp_eval.c')
-rw-r--r-- | src/lisp/ao_lisp_eval.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lisp/ao_lisp_eval.c b/src/lisp/ao_lisp_eval.c index 3e68d14a..b6cb4fd8 100644 --- a/src/lisp/ao_lisp_eval.c +++ b/src/lisp/ao_lisp_eval.c @@ -107,6 +107,7 @@ ao_lisp_eval_sexpr(void) DBGI("..frame "); DBG_POLY(ao_lisp_frame_poly(ao_lisp_frame_current)); DBG("\n"); ao_lisp_v = ao_lisp_atom_get(ao_lisp_v); /* fall through */ + case AO_LISP_BOOL: case AO_LISP_INT: case AO_LISP_STRING: case AO_LISP_BUILTIN: @@ -345,7 +346,7 @@ ao_lisp_eval_cond_test(void) DBGI("cond_test: "); DBG_POLY(ao_lisp_v); DBG(" sexprs "); DBG_POLY(ao_lisp_stack->sexprs); DBG("\n"); DBGI(".. frame "); DBG_POLY(ao_lisp_frame_poly(ao_lisp_frame_current)); DBG("\n"); DBGI(".. saved frame "); DBG_POLY(ao_lisp_stack->frame); DBG("\n"); - if (ao_lisp_v) { + if (ao_lisp_v != _ao_lisp_bool_false) { struct ao_lisp_cons *car = ao_lisp_poly_cons(ao_lisp_poly_cons(ao_lisp_stack->sexprs)->car); ao_poly c = car->cdr; @@ -432,7 +433,7 @@ ao_lisp_eval_while_test(void) DBGI(".. frame "); DBG_POLY(ao_lisp_frame_poly(ao_lisp_frame_current)); DBG("\n"); DBGI(".. saved frame "); DBG_POLY(ao_lisp_stack->frame); DBG("\n"); - if (ao_lisp_v) { + if (ao_lisp_v != _ao_lisp_bool_false) { ao_lisp_stack->values = ao_lisp_v; ao_lisp_v = ao_lisp_poly_cons(ao_lisp_stack->sexprs)->cdr; ao_lisp_stack->state = eval_while; |