diff --git a/images/apple/DRAWL.po b/images/apple/DRAWL.po index 1d7351d..64cd25c 100644 Binary files a/images/apple/DRAWL.po and b/images/apple/DRAWL.po differ diff --git a/src/lisp/loop.lisp b/src/lisp/loop.lisp index e2e3eb0..b4025ce 100644 --- a/src/lisp/loop.lisp +++ b/src/lisp/loop.lisp @@ -1,14 +1,14 @@ (DEFINE (TAILLOOP (LAMBDA (I M) (COND ((AND (< I M) (PRIN I)),(TAILLOOP (+ 1 I) M)) - (T,I)) + (T,(- I 1))) )) (PROGLOOP (LAMBDA (I M) (PROG () A (PRIN I) (SETQ I (+ I 1)) (IF (< I M) (GO A)) - (RETURN I) + (RETURN (- I 1)) ))) (FORLOOP (LAMBDA (I M) (FOR I I 1 (< I M) (PRIN I)) diff --git a/src/lisp/s-expr.pla b/src/lisp/s-expr.pla index 1e231ba..a961bc1 100644 --- a/src/lisp/s-expr.pla +++ b/src/lisp/s-expr.pla @@ -1237,11 +1237,11 @@ def natv_trace(symptr, expr) end def natv_for(symptr, expr) - var idxsym, idxint, ufunc, dlist - word[2] stepval + var index, ufunc, dlist + word[2] idxval, stepval - idxsym = expr=>car - if idxsym->type & TYPE_MASK <> SYM_TYPE + index = expr=>car + if index->type & TYPE_MASK <> SYM_TYPE puts("For index not symbol\n") return NULL fin @@ -1252,8 +1252,9 @@ def natv_for(symptr, expr) puts("FOR initial not integer\n") return NULL fin - set_assoc(idxsym, new_int(symptr=>intval[0], symptr=>intval[1])) - idxint = eval_expr(idxsym) + idxval[0] = symptr=>intval[0] + idxval[1] = symptr=>intval[1] + set_assoc(index, symptr) symptr = eval_expr(expr=>car) expr = expr=>cdr if symptr->type <> NUM_INT @@ -1277,9 +1278,10 @@ def natv_for(symptr, expr) sweep_stack[sweep_stack_top - 1] = eval_expr(expr=>car) expr = expr=>cdr loop - load32(idxint + intval) // Manipulate integer value directly! + load32(@idxval) // Update index value add32(@stepval) - store32(idxint + intval) + store32(@idxval) + set_assoc(index, new_int(idxval[0], idxval[1])) loop return pop_sweep_stack end