Re: Passing Prolog terms from Prolog to Java
Paul Singleton <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Organization | Jambusters Ltd |
| Message-ID | <[email protected]> |
On 31/03/2014 16:27, Sergio Castro wrote:
> Hello,
>
> In a couple of scenarios I need to pass complex Prolog terms from Prolog to Java (e.g., invoking from Prolog a Java method declaring one or more of its parameters as instances of the jpl.Term class).
> As far as I understand this is not possible using JPL (at least not using the JPL high level API), correct?.
No, you can pass any acyclic term as a new Term instance to a Java
method (or field, or constructor) by wrapping it as {Term} e.g.
jpl_call('com.sergio', doTerm, [{foo(bar)}], R)
If the term is cyclic, this throws
error(type_error(acyclic,T),context(jpl_call/4,_))
Paul Singleton