Re: Newb question about calling Scheme from Java

Antonio <[email protected]> Tue, 02 Sep 2008 21:56:54 +0200
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
What about interpreter.eval("(define foobar 'bar)"); ?

Mike J. Bell wrote:
> I'm trying to integrate SISC as a Scheme interpreter into a larger, 
> established product written in Java.  Anybody else do this, open-source 
> like, so I might peek at the ways and means?  Any advice on trying to 
> "replicate" a Java "programmer's" API inside SISC?  (i.e., ways to 
> automate all the (->jstring ...) and wrap/unwrap code that must go on 
> with s2j).
> 
> But I have specific questions to start out.  I need to pass a handle 
> from the "public" part of the Java API into the SISC interpreter so that 
> I might start tinkering.  (It's like a Java "environment").  I find my 
> heap, and do something like:
> 
> 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...");
> ...
> 
> The problem is that foobar isn't defined in my environment inside the 
> eval statement.  I'm guessing that context=>Symbol("r5rs") is wrong 
> here, but the API docs don't really point me in a good direction.
> 
> Can anybody help with this first bit; i.e., how can I pass things into 
> my Scheme environment properly?
> 
> Thanks in advance for any simple and/or complex hints!
> 
> -- 
> Mike J. Bell on gmail
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> 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=/
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Sisc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sisc-users


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