ref: ee9f565d89d8b953eff1f564508a2044ce844a3c
parent: 6962211e766aa6f4e864d8817beb81ccaa2856d7
author: JeffBezanson <[email protected]>
date: Fri Dec 12 16:06:20 EST 2008
fixing bug in for where lambda body was self-evaluating
--- a/femtolisp/flisp.c
+++ b/femtolisp/flisp.c
@@ -1163,7 +1163,8 @@
f = Stack[SP-5];
Stack[SP-3] = car_(f); // lambda list
Stack[SP-2] = fixnum(s); // argument value
- v = eval_sexpr(car_(cdr_(f)), SP-3, 0);
+ v = car_(cdr_(f));
+ if (!selfevaluating(v)) v = eval_sexpr(v, SP-3, 0);
}
break;
case F_SPECIAL_APPLY:
--- a/femtolisp/unittest.lsp
+++ b/femtolisp/unittest.lsp
@@ -66,6 +66,8 @@
(assert (equal (string 'sym #char(65) #wchar(945) "blah") "symA\u03B1blah"))
+; this crashed once
+(for 1 10 (lambda (i) 0))
; ok, a couple end-to-end tests as well
(define (fib n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))