klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

commit b1dd40fd7bfe18bf20d0ef8fa284a56aad57b799
parent d1cdfc3caf9ae268c842fb7e5616d712673833dd
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Wed, 23 Nov 2011 04:22:02 -0300

Bugfix: in do_map_cycle added a missing i2tv when constructing do_map continuation.

Diffstat:
Msrc/kgcombiners.c | 11++++-------
Msrc/tests/combiners.k | 2+-
Msrc/tests/test-all.k | 2+-
3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/kgcombiners.c b/src/kgcombiners.c @@ -500,7 +500,6 @@ void do_map(klisp_State *K) TValue last_pair = xparams[2]; int32_t n = ivalue(xparams[3]); TValue denv = xparams[4]; - /* XXX */ klisp_assert(ttisenvironment(denv)); bool dummyp = bvalue(xparams[5]); /* this case is used to kick start the mapping of both @@ -525,7 +524,6 @@ void do_map(klisp_State *K) /* have to unwrap the applicative to avoid extra evaluation of first */ TValue new_expr = kcons(K, kunwrap(app), first_ptree); krooted_tvs_push(K, new_expr); - /* XXX */ klisp_assert(ttisenvironment(denv)); TValue new_cont = kmake_continuation(K, kget_cc(K), do_map, 6, app, ls, last_pair, i2tv(n), denv, KFALSE); @@ -552,7 +550,6 @@ void do_map_cycle(klisp_State *K) TValue dummy = xparams[1]; int32_t cpairs = ivalue(xparams[2]); TValue denv = xparams[3]; - /* XXX */ klisp_assert(ttisenvironment(denv)); /* obj: (cycle-part . last-result-pair) */ TValue ls = kcar(obj); @@ -567,10 +564,11 @@ void do_map_cycle(klisp_State *K) /* schedule the mapping of the elements of the cycle, signal dummyp = true to avoid creating a pair for the inert value passed to the first continuation */ - /* XXX */ klisp_assert(ttisenvironment(denv)); TValue new_cont = kmake_continuation(K, encycle_cont, do_map, 6, app, ls, - last_apair, cpairs, denv, KTRUE); + last_apair, i2tv(cpairs), denv, KTRUE); + klisp_assert(ttisenvironment(denv)); + krooted_tvs_pop(K); kset_cc(K, new_cont); /* this will be like a nop and will continue with do_map */ @@ -623,13 +621,11 @@ void map(klisp_State *K) : kmake_continuation(K, kget_cc(K), do_map_cycle, 4, app, dummy, i2tv(res_cpairs), denv); - krooted_tvs_push(K, ret_cont); /* schedule the mapping of the elements of the acyclic part. signal dummyp = true to avoid creating a pair for the inert value passed to the first continuation */ - /* XXX */ klisp_assert(ttisenvironment(denv)); TValue new_cont = kmake_continuation(K, ret_cont, do_map, 6, app, lss, dummy, i2tv(res_apairs), denv, KTRUE); @@ -639,6 +635,7 @@ void map(klisp_State *K) krooted_tvs_pop(K); kset_cc(K, new_cont); + /* this will be a nop, and will continue with do_map */ kapply_cc(K, KINERT); } diff --git a/src/tests/combiners.k b/src/tests/combiners.k @@ -209,7 +209,7 @@ 10)) -#;($check equal? +($check equal? (map ($lambda (x) (- 0 x)) (list 1 . #0=(2 3 4 . #0#))) diff --git a/src/tests/test-all.k b/src/tests/test-all.k @@ -1,7 +1,7 @@ (load "tests/check.k") (load "tests/test-helpers.k") - (check-set-mode! check-mode-report) +;; (check-set-mode! check-mode-report) ;; TODO add applicative?/operative? for all cominers in all test files