ref: 83ec06d0005f053b5dce99bf2d8c24923f335e2b
parent: 875f42e80fca57e72cbedf68abfa484eea367c1d
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Dec 6 08:54:59 EST 2024
for-each: make it more readable
--- a/flisp.c
+++ b/flisp.c
@@ -2105,21 +2105,18 @@
assert(argSP >= 0 && argSP < FL(nstack));
if(FL(sp)+nargs > FL(nstack))
grow_stack();
- FL(sp) += nargs;
-
for(;;){
- FL(stack)[FL(sp)-nargs] = FL(stack)[argSP];
-
- uint32_t i, c;
- for(i = c = 1; i < nargs; i++){
+ PUSH(FL(stack)[argSP]);
+ for(uint32_t i = 1; i < nargs; i++){
if(!iscons(FL(stack)[argSP+i])){
- POPN(nargs);
+ POPN(i);
return FL(t);
}
- FL(stack)[FL(sp)-nargs+i] = car_(FL(stack)[argSP+i]);
+ PUSH(car_(FL(stack)[argSP+i]));
FL(stack)[argSP+i] = cdr_(FL(stack)[argSP+i]);
}
_applyn(nargs-1);
+ POPN(nargs);
}
}