This commit is contained in:
Justin Ethier 2015-03-02 15:20:38 -05:00
parent dd976cbb76
commit 651f6b0c7a
2 changed files with 17 additions and 11 deletions

View file

@ -1480,16 +1480,17 @@ static object apply(object cont, object func, object args){
// TODO: also, this only works if the generated code knows to call apply, want to do this,
// but again only if CYC_EVAL is defined:
//#define funcall2(cfn,a1,a2) if (type_of(cfn) == cons_tag || prim(cfn)) { Cyc_apply(1, (closure)a1, cfn,a2); } else { ((cfn)->fn)(2,cfn,a1,a2);}
case cons_tag:
if (!nullp(func) && eq(quote_Cyc_191procedure, car(func))) {
//printf("TODO: apply compound proc\n");
Cyc_display(func);
// case cons_tag:
// if (!nullp(func) && eq(quote_Cyc_191procedure, car(func))) {
// make_cons(c, func, args);
// //printf("TODO: apply compound proc\n");
// Cyc_display(&c);
// //exit(1);
// ((closure)__glo_eval)->fn(2, __glo_eval, cont, &c);
// } else {
// printf("Unable to evaluate list\n");
// exit(1);
((closure)__glo_eval)->fn(2, __glo_eval, cont, func);
} else {
printf("Unable to evaluate list\n");
exit(1);
}
// }
// TODO: #endif
default:

View file

@ -1,4 +1,7 @@
;; Temporary testing, delete this once it works
(define (mywrite x)
(write x))
(define (call fn a)
(fn a))
@ -7,4 +10,6 @@
;; Demonstrate sending an interpreted function to compiled code
;; I think in order for this to work, the compiled code would have to
;; detect an interpreted proc, and use eval to execute it
(eval '(call (lambda (x) x)))
;(eval '(call (lambda (x) x) (display (+ 1 1))))
;(eval '(call write 1))
(eval '(call mywrite 1))