Fixes to eval's apply

Properly extract the primitive function (via cadr) and compare against the appropriate tag ('primitive).
This commit is contained in:
Justin Ethier 2015-06-03 21:25:18 -04:00
parent 655ee7c04b
commit 9d34f94c3f
2 changed files with 5 additions and 8 deletions

6
TODO
View file

@ -8,12 +8,6 @@ Roadmap:
Working TODO list:
- apply seems broken:
cyclone> (apply append '((1) (2) (3)))
((1) (2) (3))
This is broken in the interpreter (eval) not in compiled code. probably a deficiency in eval.scm
- Constructs require for self-hosting
- vectors

View file

@ -1219,9 +1219,12 @@ object apply(object cont, object func, object args){
case cons_tag:
{
make_cons(c, func, args);
make_cons(c, cadr(func), args);
if (!nullp(func) && eq(quote_Cyc_191procedure, car(func))) {
// TODO: would be better to compare directly against symbol here,
// but need a way of looking up this symbol ahead of time.
// maybe a libinit() or such is required.
if (strncmp(((symbol)car(func))->pname, "primitive", 10) == 0) {
((closure)__glo_eval)->fn(3, __glo_eval, cont, &c, nil);
} else {
printf("Unable to evaluate: ");