fix closure 5
This commit is contained in:
parent
24be64787b
commit
dbbfcb5899
7
mes.c
7
mes.c
|
@ -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 *
|
||||
|
|
10
test.mes
10
test.mes
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue