Neil Jerram wrote: > > I'm not sure it's that obscure, and it seems a shame to leave this as > ammunition for those who like to claim that Guile is not R5RS-compliant.
Another possibility would be to do what SCM does. If I understand correctly, SCM does the list construction that we have noted as being necessary to pass the test, but compensates by not building the init values into a list to begin with. Instead, it builds the init values onto the stack, by using a recursive function like this: static void ecache_evalx(x) SCM x; { SCM argv[10]; int i = 0, imax = sizeof(argv)/sizeof(SCM); scm_env_tmp = EOL; while NIMP(x) { if (imax==i) { ecache_evalx(x); break; } argv[i++] = EVALCAR(x); x = CDR(x); } ENV_V2LST((long)i, argv); } The ENV_V2LST at the end then conses all the values on the stack into a list, and the calling code finishes things off by inserting that list into the extended environment. Cunning, isn't it? It passes the test because a continuation captured during an ecache_evalx call will preserve the values on the stack, and because the values on the stack are not affected by set!s on the letrec environment. What do you think? It seems like a very self-contained trick, so I think we could easily copy it to Guile. Neil _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel