Crazy (?) error in embedded interpreter using compiled syntax forms
"Mike J. Bell" <[email protected]> Thu, 11 Sep 2008 10:36:33 -0400
| Newsgroups | gmane.comp.java.sisc.user |
|---|---|
| Message-ID | <[email protected]> |
--===============1047570626== Content-Type: multipart/alternative; boundary="----=_Part_71650_33128068.1221143793658" ------=_Part_71650_33128068.1221143793658 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline So I've got a Java program that I added SISC to; it's got a console and I tied the input/output of that to a REPL running sisc-cli. (This error actually happens if I *don't* start the REPL, so I don't think the REPL is the issue). Separately, I've got a file foo.scm: ; srfi-1 is imported too for fold-right (define-syntax flatten (syntax-rules () ((_ list-of-lists) (fold-right append '() list-of-lists)))) ; other non-syntax procedure definitions, including ones that use flatten... I have compiled foo.scm to foo.scc by: (compile-file "foo.scm" "foo.scc") In my Java initialization code, I do: interpreter.eval"(load \"foo.scc\")". In my REPL, I can use the procedures in foo.scc just fine. If I say something like (flatten) [a clear abuse of syntax], I get the normal error of "Error: invalid syntax flatten". But when I try to use it normally: (flatten '((1 2) (3 4 5))) I get this weird error message: Error in memq: expected type pair, got '#3(syntax-object thread/priori... ...'. Now, if I go and redefine the syntax form by hand in the REPL, it will work fine. It only seems to not like syntax defined in foo.scc. So, my question is, what am I doing wrong? Can you not compile syntax? Should I load syntax from a .scm (non-compiled) file? Am I not compiling properly? Maybe there's something I'm not setting up in my initial environment properly that's screwing up the interpreter? Thanks in advance for any ideas... -- Mike J. Bell on gmail ------=_Part_71650_33128068.1221143793658 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline <div dir="ltr">So I've got a Java program that I added SISC to; it's got a console and I tied the input/output of that to a REPL running sisc-cli. (This error actually happens if I *don't* start the REPL, so I don't think the REPL is the issue).<br> <br>Separately, I've got a file foo.scm:<br><br>; srfi-1 is imported too for fold-right<br>(define-syntax flatten<br> (syntax-rules ()<br> ((_ list-of-lists)<br> (fold-right append '() list-of-lists))))<br>; other non-syntax procedure definitions, including ones that use flatten...<br> <br>I have compiled foo.scm to foo.scc by: (compile-file "foo.scm" "foo.scc")<br><br>In my Java initialization code, I do: interpreter.eval"(load \"foo.scc\")".<br><br>In my REPL, I can use the procedures in foo.scc just fine. If I say something like (flatten) [a clear abuse of syntax], I get the normal error of "Error: invalid syntax flatten". But when I try to use it normally:<br> <br>(flatten '((1 2) (3 4 5)))<br><br>I get this weird error message:<br><br>Error in memq: expected type pair, got '#3(syntax-object thread/priori... ...'.<br><br>Now, if I go and redefine the syntax form by hand in the REPL, it will work fine. It only seems to not like syntax defined in foo.scc.<br> <br>So, my question is, what am I doing wrong? Can you not compile syntax? Should I load syntax from a .scm (non-compiled) file? Am I not compiling properly? Maybe there's something I'm not setting up in my initial environment properly that's screwing up the interpreter?<br> <br>Thanks in advance for any ideas...<br clear="all"><br>-- <br>Mike J. Bell on gmail<br> </div> ------=_Part_71650_33128068.1221143793658-- --===============1047570626== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ --===============1047570626== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Sisc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sisc-users --===============1047570626==--