Re: Newb question about calling Scheme from Java

"Mike J. Bell" <[email protected]> Wed, 3 Sep 2008 06:17:28 -0400
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
--===============0068545222==
Content-Type: multipart/alternative; 
	boundary="----=_Part_22997_21506558.1220437048054"

------=_Part_22997_21506558.1220437048054
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Tue, Sep 2, 2008 at 5:12 PM, Scott G. Miller <[email protected]> wrote:

> On Tue, Sep 2, 2008 at 2:15 PM, Mike J. Bell <[email protected]> wrote:
>
> >
> > Context.execute(appContext, new SchemeCaller() {
> >     public Object execute(Interpreter interpreter) throws SchemeException
> {
> >         Symbol symbol = new Symbol("foobar");
> >         Value value = SchemeBoolean.TRUE;
> >         Symbol context = new Symbol("r5rs");
> >
> >         interpreter.define(symbol, value, context);
> >         interpreter.eval("...my scheme code...");
> > ...
> >
> Not sure this is your problem, but you want Symbol.get("foobar"), not
> new Symbol.  If you don't do this, the resulting Symbol is distinct
> from any other in SISC, and won't match ordinary symbols in Scheme.
>
> Scott
>

Hrm, that didn't work.  Changed new Symbol("...") to Symbol.get("..."), and
my error message is still

sisc.interpreter.SchemeException: ((message . "undefined variable
'foobar'."))
at sisc.interpreter.SchemeRuntimeException.promote
...Interpreter.interpret
...Interpreter.interpret
...Interpreter.eval
...

The code in question is

(max-stack-trace-depth 16)

(begin
  (display (+ 1 2))
  (newline)
  (display foobar)
  (newline))

;; (fairly innocuous!)
;; (and I really am trying to bind #t to 'foobar)

Am I just totally off base with this?  Thanks again...

-- 
Mike J. Bell on gmail

------=_Part_22997_21506558.1220437048054
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div dir="ltr">On Tue, Sep 2, 2008 at 5:12 PM, Scott G. Miller <span dir="ltr">&lt;<a href="mailto:[email protected]">[email protected]</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Tue, Sep 2, 2008 at 2:15 PM, Mike J. Bell &lt;<a href="mailto:[email protected]">[email protected]</a>&gt; wrote:<br>
<br>
&gt;<br>
&gt; Context.execute(appContext, new SchemeCaller() {<br>
&gt; &nbsp; &nbsp; public Object execute(Interpreter interpreter) throws SchemeException {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; Symbol symbol = new Symbol(&quot;foobar&quot;);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; Value value = SchemeBoolean.TRUE;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; Symbol context = new Symbol(&quot;r5rs&quot;);<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; interpreter.define(symbol, value, context);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; interpreter.eval(&quot;...my scheme code...&quot;);<br>
&gt; ...<br>
&gt;<br>
</div>Not sure this is your problem, but you want Symbol.get(&quot;foobar&quot;), not<br>
new Symbol. &nbsp;If you don&#39;t do this, the resulting Symbol is distinct<br>
from any other in SISC, and won&#39;t match ordinary symbols in Scheme.<br>
<font color="#888888"><br>
Scott<br>
</font></blockquote></div><br>Hrm, that didn&#39;t work.&nbsp; Changed new Symbol(&quot;...&quot;) to Symbol.get(&quot;...&quot;), and my error message is still<br><br>sisc.interpreter.SchemeException: ((message . &quot;undefined variable &#39;foobar&#39;.&quot;))<br>
at sisc.interpreter.SchemeRuntimeException.promote<br>...Interpreter.interpret<br>...Interpreter.interpret<br>...Interpreter.eval<br>...<br><br>The code in question is<br><br>(max-stack-trace-depth 16)<br><br>(begin<br>&nbsp; (display (+ 1 2))<br>
&nbsp; (newline)<br>&nbsp; (display foobar)<br>&nbsp; (newline))<br><br>;; (fairly innocuous!)<br>;; (and I really am trying to bind #t to &#39;foobar)<br><br>Am I just totally off base with this?&nbsp; Thanks again...<br clear="all"><br>-- <br>
Mike J. Bell on gmail<br>
</div>

------=_Part_22997_21506558.1220437048054--


--===============0068545222==
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=/
--===============0068545222==
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

--===============0068545222==--