fix closure 5

This commit is contained in:
Jan Nieuwenhuizen 2016-07-22 09:00:32 +02:00
parent 24be64787b
commit dbbfcb5899
2 changed files with 13 additions and 4 deletions

7
mes.c
View file

@ -273,9 +273,6 @@ apply_env (scm *fn, scm *x, scm *a)
return call (&scm_call_with_values_env, append2 (x, cons (a, &scm_nil)));
if (builtin_p (fn) == &scm_t)
return call (fn, x);
scm *efn = eval (fn, a);
if (efn->type == NUMBER || efn == &scm_f || efn == &scm_t) assert (!"apply bool");
return apply_env (efn, x, a);
}
else if (car (fn) == &symbol_lambda)
return eval (cons (&symbol_begin, cddr (fn)), pairlis (cadr (fn), x, a));
@ -294,7 +291,9 @@ apply_env (scm *fn, scm *x, scm *a)
scm *e = eval (r, a);
return apply_env (e, x, a);
}
return &scm_unspecified;
scm *efn = eval (fn, a);
if (efn->type == NUMBER || efn == &scm_f || efn == &scm_t) assert (!"apply bool");
return apply_env (efn, x, a);
}
scm *

View file

@ -199,6 +199,16 @@
(count)))
0))
(pass-if "closure 5 "
(seq? (begin
(define foo
(lambda ()
(define name? symbol?)
(lambda ()
(name? 'boo))))
((foo)))
#t))
(newline)
(display "passed: ") (display (car (result))) (newline)
(display "failed: ") (display (cadr (result))) (newline)