info-gnuprologjava
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Info-gnuprologjava] Question on loading Prolog files


From: Daniel Thomas
Subject: Re: [Info-gnuprologjava] Question on loading Prolog files
Date: Tue, 21 May 2013 09:35:34 +0100

Hello Sergio,

The ISO predicate "ensure_loaded/1" does work. I am pretty sure that
doing "env.runInitialization(...)" again will only execute new
initialization goals as I recall there as being a list which gets
processed and emptied.

I hope that helps,

Daniel

On Fri, 2013-05-17 at 10:43 -0700, Sergio Castro wrote:
> I was looking for a Prolog interpreter embedded in Java and this
> project took my interest.
> 
> 
> 
> I am reading the setup instructions in the user manual
> (http://www.gnu.org/software/gnuprologjava/manual/Constructing-Terms.html#Constructing-Terms)
>  and there is something that is not entirely clear to me. Quoting relevant 
> sentences from the manual:
> 
> 
> 
> ---
> 
> ..."load any prolog files you want to which define additional
> predicates etc using environment.ensureLoaded(AtomTerm.get(``URL of
> file'')) for each file. " ...
> "you will need to create at least one gnu.prolog.vm.Interpreter which
> is used to execute goals. You do this using
> environment.createInterpreter(). "
> 
> "Having created it you need to use it to run the initialization of any
> files you have loaded by using env.runInitialization(interpreter);.
> This ensures the goals contained in any “:- initialization(goal).” or
> “:- goal.”s in the files you have loaded are run."
> ---
> 
> 
> 
> Does it mean that the only mechanism for loading files is with
> "environment.ensureLoaded" ? So the ISO predicate "ensure_loaded/1"
> does not work ?
> I am wondering if there is a way to load additional files after the
> Interpreter has been created and initialized with
> "env.runInitialization(...)"? 
> 
> 
> I guess that in case "environment.ensureLoaded(...)" needs to be
> called again AFTER the instantiation and initialization of the
> interpreter then 
> "env.runInitialization(...)" should also be called again in order to
> load any “:- initialization(goal).” or “:- goal.”s in the new loaded
> file ???. 
> 
> If this is correct, does it mean that all the initialization
> directives that were executed in the first call to
> "env.runInitialization(...)" will be executed again ?
> 
> 
> 
> Thanks for any help on this regard,
> 
> 
> cheers,
> 
> 
> Sergio
> 
> 

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]