From bc3df6dd17bfd567964f5f0baeca6a7e96c32960 Mon Sep 17 00:00:00 2001 From: Jesse McDonald Date: Sun, 11 Apr 2010 19:18:46 -0500 Subject: [PATCH] Swap continuation & context in the lambda and template structures. This is to separate the three 'call' parameters (target, argv, ctx) from the 'return to' parameter (k). The old order made it look as if the dynamic context was in some way related to the continuation, which is not the case. --- builtin.c | 8 ++++---- builtin.h | 8 ++++---- doc/bytecode.txt | 8 ++++---- doc/translation.txt | 22 +++++++++++----------- interp.c | 14 +++++++------- interp.h | 2 +- src/examples/cat.rla | 16 ++++++++-------- src/examples/factorial.rla | 4 ++-- src/examples/test-and.rla | 4 ++-- src/examples/test-append.rla | 4 ++-- src/examples/test-foldl.rla | 6 +++--- src/examples/test-foldr.rla | 6 +++--- src/examples/test-list.rla | 4 ++-- src/examples/test-map.rla | 4 ++-- src/examples/test-or.rla | 4 ++-- src/examples/test-reverse.rla | 4 ++-- src/lib/math/fact.rla | 10 +++++----- src/lib/primitive/acons.rla | 2 +- src/lib/primitive/and.rla | 10 +++++----- src/lib/primitive/append.rla | 8 ++++---- src/lib/primitive/cons.rla | 2 +- src/lib/primitive/foldl.rla | 10 +++++----- src/lib/primitive/foldr.rla | 10 +++++----- src/lib/primitive/list.rla | 4 ++-- src/lib/primitive/map.rla | 14 +++++++------- src/lib/primitive/or.rla | 10 +++++----- src/lib/primitive/reverse.rla | 4 ++-- 27 files changed, 101 insertions(+), 101 deletions(-) diff --git a/builtin.c b/builtin.c index 13770b5..07810d1 100644 --- a/builtin.c +++ b/builtin.c @@ -144,10 +144,10 @@ static void register_template(gc_root_t *ms_root) WRITE_BARRIER(vec_root.value); _get_vector(vec_root.value)->elements[TS(ARG_LIST)] = string_to_value("argument-list"); WRITE_BARRIER(vec_root.value); - _get_vector(vec_root.value)->elements[TS(CONTINUATION)] = string_to_value("continuation"); - WRITE_BARRIER(vec_root.value); _get_vector(vec_root.value)->elements[TS(CONTEXT)] = string_to_value("context"); WRITE_BARRIER(vec_root.value); + _get_vector(vec_root.value)->elements[TS(CONTINUATION)] = string_to_value("continuation"); + WRITE_BARRIER(vec_root.value); unregister_gc_root(&vec_root); } /* Slot 4: Callable object used as proxy when structure is apply'd. */ @@ -192,10 +192,10 @@ static void register_lambda(gc_root_t *ms_root) WRITE_BARRIER(vec_root.value); _get_vector(vec_root.value)->elements[LS(ARG_LIST)] = string_to_value("argument-list"); WRITE_BARRIER(vec_root.value); - _get_vector(vec_root.value)->elements[LS(CONTINUATION)] = string_to_value("continuation"); - WRITE_BARRIER(vec_root.value); _get_vector(vec_root.value)->elements[LS(CONTEXT)] = string_to_value("context"); WRITE_BARRIER(vec_root.value); + _get_vector(vec_root.value)->elements[LS(CONTINUATION)] = string_to_value("continuation"); + WRITE_BARRIER(vec_root.value); unregister_gc_root(&vec_root); } /* Slot 4: Callable object used as proxy when structure is apply'd. */ diff --git a/builtin.h b/builtin.h index a8fef28..93ce808 100644 --- a/builtin.h +++ b/builtin.h @@ -33,8 +33,8 @@ #define TEMPLATE_SLOT_BYTE_CODE 3 #define TEMPLATE_SLOT_TAIL_CALL 4 #define TEMPLATE_SLOT_ARG_LIST 5 -#define TEMPLATE_SLOT_CONTINUATION 6 -#define TEMPLATE_SLOT_CONTEXT 7 +#define TEMPLATE_SLOT_CONTEXT 6 +#define TEMPLATE_SLOT_CONTINUATION 7 #define TEMPLATE_SLOTS 8 #define LAMBDA_SLOT_GLOBAL_VARS 0 @@ -43,8 +43,8 @@ #define LAMBDA_SLOT_BYTE_CODE 3 #define LAMBDA_SLOT_TAIL_CALL 4 #define LAMBDA_SLOT_ARG_LIST 5 -#define LAMBDA_SLOT_CONTINUATION 6 -#define LAMBDA_SLOT_CONTEXT 7 +#define LAMBDA_SLOT_CONTEXT 6 +#define LAMBDA_SLOT_CONTINUATION 7 #define LAMBDA_SLOTS 8 void builtin_init(void); diff --git a/doc/bytecode.txt b/doc/bytecode.txt index 775101b..41beaf4 100644 --- a/doc/bytecode.txt +++ b/doc/bytecode.txt @@ -155,8 +155,8 @@ in: -- (11111NNN) [reserved, N < 4] self (11111100) [current lambda] argv (11111101) [argument list] - k (11111110) [continuation] - ctx (11111111) [dynamic context] + ctx (11111110) [dynamic context] + k (11111111) [continuation] out: fN (1NNNNNNN) [0 <= N < 120] @@ -168,8 +168,8 @@ lambda:[ code: byte-string containing sequence of 4-byte instruction words tail-call: in-ref of lambda to tail-call arguments: in-ref of argument list to pass to tail-call - continuation: in-ref of continuation to pass to tail-call context: in-ref of dynamic context to pass to tail-call + continuation: in-ref of continuation to pass to tail-call ] template:[ @@ -179,8 +179,8 @@ template:[ code: linked tail-call: copied verbatim arguments: copied verbatim - continuation: copied verbatim context: copied verbatim + continuation: copied verbatim ] Protocol: diff --git a/doc/translation.txt b/doc/translation.txt index c688d6d..895e924 100644 --- a/doc/translation.txt +++ b/doc/translation.txt @@ -116,7 +116,7 @@ k ) #S(template ; g2 - #() + #(#f) #B(f0) 1 ; f0 #B( @@ -124,8 +124,8 @@ ) k f0 - ctx - nil + g1 + g1 ) ) #() @@ -166,7 +166,7 @@ #0=#S(lambda #( #S(lambda ; g1 = (lambda (k) (k 1)) - #(1) ; g1 = 1 + #(1 #f) ; g1 = 1; g2 = #f #() ; instance 1 ; frame (f0) #B( @@ -174,25 +174,25 @@ ) k ; tail-call f0 ; arguments - ctx ; dynamic context - nil ; continuation + g2 ; dynamic context + g2 ; continuation ) #S(template ; g2 = (lambda (k) ...) #( #=0 ; g1 = fact #S(template ; g2 = (lambda (_ m) (k (* n m))) - #() ; globals - #B(i0 ctx k) ; instance (i0=n, i1=ctx, i2=k) + #(#f) ; globals + #B(i0 k) ; instance (i0=n, i1=k) 1 ; frame (f0) #B( (set! f0 (car argv)) (set! f0 (fix* i0 f0)) (set! f0 (cons f0 nil)) ) - i2 - f0 i1 - nil + f0 + g1 + g1 ) 1 ; g3 = 1 ) diff --git a/interp.c b/interp.c index 8f7536a..5795b6c 100644 --- a/interp.c +++ b/interp.c @@ -91,8 +91,8 @@ value_t run_interpreter(value_t lambda, value_t argv) fflush(stdout); fputs("LAMBDA: ", stderr); fprint_value(stderr, state.lambda.value); fputc('\n', stderr); fputs("ARGLIST: ", stderr); fprint_value(stderr, state.argv.value); fputc('\n', stderr); - fputs("CONT'N: ", stderr); fprint_value(stderr, state.k.value); fputc('\n', stderr); fputs("CONTEXT: ", stderr); fprint_value(stderr, state.ctx.value); fputc('\n', stderr); + fputs("CONT'N: ", stderr); fprint_value(stderr, state.k.value); fputc('\n', stderr); fputc('\n', stderr); fflush(stderr); #endif @@ -323,13 +323,13 @@ static void perform_tail_call(interp_state_t *state) new_lambda = get_input(state, get_fixnum(_LAMBDA_SLOT(state->lambda.value, TAIL_CALL))); new_argv = get_input(state, get_fixnum(_LAMBDA_SLOT(state->lambda.value, ARG_LIST))); - new_k = get_input(state, get_fixnum(_LAMBDA_SLOT(state->lambda.value, CONTINUATION))); new_ctx = get_input(state, get_fixnum(_LAMBDA_SLOT(state->lambda.value, CONTEXT))); + new_k = get_input(state, get_fixnum(_LAMBDA_SLOT(state->lambda.value, CONTINUATION))); state->lambda.value = new_lambda; state->argv.value = new_argv; - state->k.value = new_k; state->ctx.value = new_ctx; + state->k.value = new_k; } static value_t eval_expression(interp_state_t *state, uint8_t code, uint8_t in1, uint8_t in2) @@ -544,9 +544,9 @@ static value_t get_input(const interp_state_t *state, fixnum_t var) case 253: return state->argv.value; case 254: - return state->k.value; - case 255: return state->ctx.value; + case 255: + return state->k.value; default: return UNDEFINED; } @@ -570,8 +570,8 @@ static void register_state(interp_state_t *state, value_t lambda, value_t argv) register_gc_root(&state->lambda, lambda); register_gc_root(&state->argv, argv); register_gc_root(&state->frame, make_vector(120, UNDEFINED)); - register_gc_root(&state->k, FALSE_VALUE); register_gc_root(&state->ctx, FALSE_VALUE); + register_gc_root(&state->k, FALSE_VALUE); register_gc_root(&state->in1, FALSE_VALUE); register_gc_root(&state->in2, FALSE_VALUE); register_gc_root(&state->in3, FALSE_VALUE); @@ -582,8 +582,8 @@ static void unregister_state(interp_state_t *state) unregister_gc_root(&state->lambda); unregister_gc_root(&state->argv); unregister_gc_root(&state->frame); - unregister_gc_root(&state->k); unregister_gc_root(&state->ctx); + unregister_gc_root(&state->k); unregister_gc_root(&state->in1); unregister_gc_root(&state->in2); unregister_gc_root(&state->in3); diff --git a/interp.h b/interp.h index 6f46889..44cdb66 100644 --- a/interp.h +++ b/interp.h @@ -8,8 +8,8 @@ typedef struct interp_state gc_root_t lambda; gc_root_t frame; gc_root_t argv; - gc_root_t k; gc_root_t ctx; + gc_root_t k; gc_root_t in1; gc_root_t in2; gc_root_t in3; diff --git a/src/examples/cat.rla b/src/examples/cat.rla index dc6d027..2811d7c 100755 --- a/src/examples/cat.rla +++ b/src/examples/cat.rla @@ -53,7 +53,7 @@ ; ((lambda _ (loop)) (posix-write 1 str result)) ; (k))) #(0 1 #="posix-write") - "\x41\xfc\xfe\xff" ; #(i1=str self=loop k ctx) + "\x41\xfc\xfe\xff" ; #(i1=str self=loop ctx k) 2 "\x00\x81\x03\xfd\; (set! f1 (car argv)) \x02\x80\x81\x00\; (set! f0 (cons f1 nil)) @@ -61,11 +61,11 @@ \x02\x80\x02\x80\; (set! f0 (cons g2 f0)) \x01\x81\x81\x01\; (set! f1 (eq? f1 g1)) \x80\x81\x00\x80\; (set! f0 (if f1 nil f0)) - \x81\x81\x42\x03"; (set! f1 (if f1 i2 g3)) + \x81\x81\x43\x03"; (set! f1 (if f1 i3 g3)) 0x81 ; f1 0x80 ; f0 + 0x42 ; i2 0x41 ; i1 - 0x43 ; i3 ) ) "\x80\x81" ; #(f0 f1) @@ -77,8 +77,8 @@ \x00\x81\x1b\x02"; (set! f1 (lambda g2)) 0x01 ; g1 0x80 ; f0 + 0xfe ; ctx 0x81 ; f1 - 0xff ; ctx ) ) #() @@ -88,11 +88,11 @@ \x00\x82\x1b\x03"; (set! f2 (lambda g3)) 0x82 ; f2 0x00 ; nil - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ) - "\xfe\xff" ; k ctx + "\xfe\xff" ; ctx k 1 "\x00\x80\x03\xfd\; (set! f0 (car argv)) \x80\x80\x01\x40\; (set! f0 (if f0 g1 i0)) @@ -111,8 +111,8 @@ \x00\x81\x1b\x03"; (set! f1 (lambda g3)) 0x02 ; g2 0x80 ; f0 + 0xfe ; ctx 0x81 ; f1 - 0xff ; ctx ) ; vim:set sw=2 expandtab syntax=: diff --git a/src/examples/factorial.rla b/src/examples/factorial.rla index c8c5c2a..ff28eb1 100755 --- a/src/examples/factorial.rla +++ b/src/examples/factorial.rla @@ -17,7 +17,7 @@ #( #i"../lib/math/fact.rla" ) - "\xfe\xff" ; k ctx + "\xfe\xff" ; ctx k 0 "" 0x01 ; g1 @@ -32,7 +32,7 @@ "\x00\x80\x1b\x01"; (set! f0 (lambda g1)) 0x02 ; g2 0xfd ; argv + 0xfe ; ctx 0x80 ; f0 - 0xff ; ctx ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/examples/test-and.rla b/src/examples/test-and.rla index ed1940b..6db64f6 100644 --- a/src/examples/test-and.rla +++ b/src/examples/test-and.rla @@ -20,7 +20,7 @@ "" 0x01 ; g1 0x02 ; g2 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/examples/test-append.rla b/src/examples/test-append.rla index ed503d0..b97d334 100644 --- a/src/examples/test-append.rla +++ b/src/examples/test-append.rla @@ -10,7 +10,7 @@ "" 0x01 ; g1 0x02 ; g2 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/examples/test-foldl.rla b/src/examples/test-foldl.rla index c1d79de..a147372 100644 --- a/src/examples/test-foldl.rla +++ b/src/examples/test-foldl.rla @@ -15,7 +15,7 @@ \x00\x81\x03\x81\; (set! f1 (car f1)) \x08\x80\x80\x81\; (set! f0 (fix+ f0 f1)) \x02\x80\x80\x00"; (set! f0 (cons f0 nil)) - 0xfe ; k + 0xff ; k 0x80 ; f0 0x01 ; g1 0x01 ; g1 @@ -29,7 +29,7 @@ "" 0x01 ; g1 0x02 ; g2 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/examples/test-foldr.rla b/src/examples/test-foldr.rla index 9ea2c7f..98b7f36 100644 --- a/src/examples/test-foldr.rla +++ b/src/examples/test-foldr.rla @@ -15,7 +15,7 @@ \x00\x81\x03\x81\; (set! f1 (car f1)) \x08\x80\x80\x81\; (set! f0 (fix+ f0 f1)) \x02\x80\x80\x00"; (set! f0 (cons f0 nil)) - 0xfe ; k + 0xff ; k 0x80 ; f0 0x01 ; g1 0x01 ; g1 @@ -29,7 +29,7 @@ "" 0x01 ; g1 0x02 ; g2 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/examples/test-list.rla b/src/examples/test-list.rla index 007cc8f..357dd87 100644 --- a/src/examples/test-list.rla +++ b/src/examples/test-list.rla @@ -10,7 +10,7 @@ "" 0x01 ; g1 0x02 ; g2 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/examples/test-map.rla b/src/examples/test-map.rla index 3aa8d53..0de74c3 100644 --- a/src/examples/test-map.rla +++ b/src/examples/test-map.rla @@ -13,7 +13,7 @@ "" 0x01 ; g1 0x02 ; g2 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/examples/test-or.rla b/src/examples/test-or.rla index a416e29..50a8f7f 100644 --- a/src/examples/test-or.rla +++ b/src/examples/test-or.rla @@ -20,7 +20,7 @@ "" 0x01 ; g1 0x02 ; g2 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/examples/test-reverse.rla b/src/examples/test-reverse.rla index 288ccad..99b8a6f 100644 --- a/src/examples/test-reverse.rla +++ b/src/examples/test-reverse.rla @@ -10,7 +10,7 @@ "" 0x01 ; g1 0x02 ; g2 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/lib/math/fact.rla b/src/lib/math/fact.rla index 3103a87..45455e9 100755 --- a/src/lib/math/fact.rla +++ b/src/lib/math/fact.rla @@ -17,7 +17,7 @@ #() 0 "" - 0xfe ; k + 0xff ; k 0x01 ; g1 0x02 ; g2 0x02 ; g2 @@ -37,7 +37,7 @@ ; (lambda (m) ; (k (* n m))))) #(#f) - "\x40\xfe" ; i0 k + "\x40\xff" ; i0 k 1 "\x00\x80\x03\xfd\; (set! f0 (car argv)) \x0a\x80\x40\x80\; (set! f0 (fix* i0 f0)) @@ -56,8 +56,8 @@ \x00\x81\x1b\x02"; (set! f1 (lambda g2)) 0x03 ; g3 0x80 ; f0 + 0xfe ; ctx 0x81 ; f1 - 0xff ; ctx ) ) #() @@ -68,7 +68,7 @@ \x00\x81\x1b\x81"; (set! f1 (lambda f1)) 0x81 ; f1 0x00 ; nil - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/lib/primitive/acons.rla b/src/lib/primitive/acons.rla index 248d3d7..beb5d5c 100644 --- a/src/lib/primitive/acons.rla +++ b/src/lib/primitive/acons.rla @@ -12,7 +12,7 @@ \x02\x81\x81\x82\; (set! f1 (cons f1 f2)) \x02\x80\x80\x81\; (set! f0 (cons f0 f1)) \x02\x80\x80\x00"; (set! f0 (cons f0 nil)) - 0xfe ; k + 0xff ; k 0x80 ; f0 0x01 ; g1 0x01 ; g1 diff --git a/src/lib/primitive/and.rla b/src/lib/primitive/and.rla index 23444ea..01bc86f 100644 --- a/src/lib/primitive/and.rla +++ b/src/lib/primitive/and.rla @@ -25,7 +25,7 @@ ; (lambda (x) ; ((if x k2 k) x)) #(#f) - "\x40\xfe" ; i0 k + "\x40\xff" ; i0 k 1 "\x00\x80\x03\xfd\; (set! f0 (car argv)) \x80\x80\x41\x40"; (set! f0 (if f0 i1 i0)) @@ -35,14 +35,14 @@ 0x01 ; g1 ) ) - "\xfe" ; k + "\xff" ; k 2 "\x00\x80\x03\xfd\; (set! f0 (car argv)) \x00\x81\x1b\x01"; (set! f1 (lambda g1)) 0x80 ; f0 0x00 ; nil + 0xfe ; ctx 0x81 ; f1 - 0xff ; ctx ) #t ) @@ -54,7 +54,7 @@ \x02\x80\x81\x80"; (set! f0 (cons f1 f0)) 0x01 ; g1 0x80 ; f0 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/lib/primitive/append.rla b/src/lib/primitive/append.rla index adf8044..6efa1b7 100644 --- a/src/lib/primitive/append.rla +++ b/src/lib/primitive/append.rla @@ -24,8 +24,8 @@ \x02\x81\x02\x81"; (set! f1 (cons g2 f1)) 0x01 ; g1 0x81 ; f1 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ) #() @@ -35,7 +35,7 @@ \x02\x80\x02\x80"; (set! f0 (cons g2 f0)) 0x01 ; g1 0x80 ; f0 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/lib/primitive/cons.rla b/src/lib/primitive/cons.rla index d315728..3effd6c 100644 --- a/src/lib/primitive/cons.rla +++ b/src/lib/primitive/cons.rla @@ -9,7 +9,7 @@ \x00\x81\x03\x81\; (set! f1 (car f1)) \x02\x80\x80\x81\; (set! f0 (cons f0 f1)) \x02\x80\x80\x00"; (set! f0 (cons f0 nil)) - 0xfe ; k + 0xff ; k 0x80 ; f0 0x01 ; g1 0x01 ; g1 diff --git a/src/lib/primitive/foldl.rla b/src/lib/primitive/foldl.rla index 7b45d31..3f5bfa3 100644 --- a/src/lib/primitive/foldl.rla +++ b/src/lib/primitive/foldl.rla @@ -19,7 +19,7 @@ "\x81" ; f1 1 "\x02\x80\x40\x00"; (set! f0 (cons i0 nil)) - 0xfe ; k + 0xff ; k 0x80 ; f0 0x01 ; g1 0x01 ; g1 @@ -36,7 +36,7 @@ ; (lambda (new-init) ; (k (foldl fn new-init (cdr lst)))) #(#=0) - "\x40\x41\x42\xfe\xff" ; i0 i1 i2 k ctx + "\x40\x41\x42\xfe\xff" ; i0 i1 i2 ctx k 2 "\x00\x80\x04\x42\; (set! f0 (cdr i2)) \x02\x80\x80\x00\; (set! f0 (cons f0 nil)) @@ -57,8 +57,8 @@ \x00\x81\x1b\x01"; (set! f1 (lambda g1)) 0x40 ; i0 0x80 ; f0 + 0xfe ; ctx 0x81 ; f1 - 0xff ; ctx ) ) #() @@ -73,7 +73,7 @@ \x00\x83\x1b\x83"; (set! f0 (lambda f3)) 0x83 ; f0 0x00 ; nil - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/lib/primitive/foldr.rla b/src/lib/primitive/foldr.rla index 4e118fa..1003816 100644 --- a/src/lib/primitive/foldr.rla +++ b/src/lib/primitive/foldr.rla @@ -21,7 +21,7 @@ "\x81" ; f1 1 "\x02\x80\x40\x00"; (set! f0 (cons i0 nil)) - 0xfe ; k + 0xff ; k 0x80 ; f0 0x01 ; g1 0x01 ; g1 @@ -37,7 +37,7 @@ #S(#="template" ; (lambda (v) (k (fn lstcar v))) #() - "\x40\x81\xfe\xff" ; i0 f1 k ctx + "\x40\x81\xfe\xff" ; i0 f1 ctx k 1 "\x00\x80\x03\xfd\; (set! f0 (car argv)) \x02\x80\x80\x00\; (set! f0 (cons f0 nil)) @@ -59,8 +59,8 @@ \x02\x83\x40\x83"; (set! f3 (cons i0 f3)) 0x02 ; g2 0x83 ; f3 + 0xfe ; ctx 0x82 ; f2 - 0xff ; ctx ) ) #() @@ -75,7 +75,7 @@ \x00\x83\x1b\x83"; (set! f3 (lambda f3)) 0x83 ; f3 0x00 ; nil - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/lib/primitive/list.rla b/src/lib/primitive/list.rla index 7c4c1a9..b1e9904 100644 --- a/src/lib/primitive/list.rla +++ b/src/lib/primitive/list.rla @@ -13,7 +13,7 @@ \x02\x80\x02\x80"; (set! f0 (cons g2 f0)) 0x01 ; g1 0x80 ; f0 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/lib/primitive/map.rla b/src/lib/primitive/map.rla index 7c3943f..f2974bd 100644 --- a/src/lib/primitive/map.rla +++ b/src/lib/primitive/map.rla @@ -17,7 +17,7 @@ ; (lambda (y) ; (k (cons y rlst))) #(#f) - "\x81\xfe\xff" ; f1 k ctx + "\x81\xff" ; f1 k 1 "\x00\x80\x03\xfd\; (set! f0 (car argv)) \x02\x80\x80\x40\; (set! f0 (cons f0 i0)) @@ -37,20 +37,20 @@ \x02\x80\x80\x00"; (set! f0 (cons f0 nil)) 0x40 ; i0 0x80 ; f0 + 0xfe ; ctx 0x81 ; f1 - 0xff ; ctx ) #S(#="template" ; (lambda (rlst) ; (k (reverse rlst))) - #(#f #i"reverse.rla") - "\xfe" + #(#i"reverse.rla") + "\xfe\xff" ; ctx k 0 "" - 0x02 ; g2 + 0x01 ; g1 0xfd ; argv 0x40 ; i0 - 0x01 ; g1 + 0x41 ; i1 ) ) #() @@ -65,7 +65,7 @@ \x00\x83\x1b\x03"; (set! f3 (lambda g3)) 0x01 ; g1 0x82 ; f2 + 0xfe ; ctx 0x83 ; f3 - 0xff ; ctx ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/lib/primitive/or.rla b/src/lib/primitive/or.rla index 8048a16..dd9d908 100644 --- a/src/lib/primitive/or.rla +++ b/src/lib/primitive/or.rla @@ -25,7 +25,7 @@ ; (lambda (x) ; ((if x k2 k) x)) #(#f) - "\x40\xfe" ; i0 k + "\x40\xff" ; i0 k 1 "\x00\x80\x03\xfd\; (set! f0 (car argv)) \x80\x80\x40\x41"; (set! f0 (if f0 i0 i1)) @@ -35,14 +35,14 @@ 0x01 ; g1 ) ) - "\xfe" ; k + "\xff" ; k 2 "\x00\x80\x03\xfd\; (set! f0 (car argv)) \x00\x81\x1b\x01"; (set! f1 (lambda g1)) 0x80 ; f0 0x00 ; nil + 0xfe ; ctx 0x81 ; f1 - 0xff ; ctx ) #f ) @@ -54,7 +54,7 @@ \x02\x80\x81\x80"; (set! f0 (cons f1 f0)) 0x01 ; g1 0x80 ; f0 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: diff --git a/src/lib/primitive/reverse.rla b/src/lib/primitive/reverse.rla index 1b128fd..049a06c 100644 --- a/src/lib/primitive/reverse.rla +++ b/src/lib/primitive/reverse.rla @@ -14,7 +14,7 @@ \x02\x80\x02\x80"; (set! f0 (cons g2 f0)) 0x01 ; g1 0x80 ; f0 - 0xfe ; k - 0xff ; ctx + 0xfe ; ctx + 0xff ; k ) ; vim:set syntax= sw=2 expandtab: