Thanks! It works well for me. My data file is small but can change often and I don't want to have to recompile every time it changes.
I was looking in all the wrong sections for finding import.
ciao wrote:
Hi John, not sure exactly if this is what you are looking for, but here is an example of how to load a module dynamically:
:- module(_,_).
:- import(bar,[b/1]).
main(X) :- use_module(bar), b(X).
The import declaration should only be used in these cases (see the manual). It only declares the interface: bar is not loaded until run time when the use_module call is executed (and can thus have different contents for each run).
A two-argument module declaration ':- module(_,_).' loads in the executable all the normal Prolog functionality and thus also the runtime compiler (needed for dynamic predicate load). If you are specifying the packages loaded by hand (i.e., using the third argument of the module declaration) then the runtime compiler is not loaded by default (useful for smaller executables) and you have to load it explicitly:
:- module(_,_,[]).
:- import(bar,[b/1]). :- use_module(library(compiler)).
main(X) :- use_module(bar), b(X).
Hope this helps! --Manuel H
--
----------------------- The Ciao System Development Team
The CLIP Group | IMDEA Software Institute ciao(a)clip.dia.fi.upm.es | and Technical University of Madrid http://www.ciao-lang.org / http://www.cliplab.org
Ciao-users mailing list Ciao-users(a)clip.dia.fi.upm.es http://clip.dia.fi.upm.es/cgi-bin/mailman/listinfo/ciao-users