3

Case: I have a file, solution.pl, where I want to use the rules of another file (this is the definition of the program, not up to me, but I think it's somewhat common).

So I'm using Ciao Prolog and the syntax seems to be ensure_loaded('c:/Path').

but when I try to use the rules of the other file, it tells me he doesn't know what rule I'm trying to use.

On the other hand, if I write on the console that same lane, and then query again, it does work.

So I was wondering maybe the syntax for doing it on the console and on a file are different??

Could someone tell me a step by step so I can figure it out if I'm missing something? What I'm doing right now is loading the program as I would do with smaller programs, then try to query rules of the file included in the ensure_loaded command. And as I said, it does seem to work if write the command outside of the program.

Dima Chubarov
  • 16,199
  • 6
  • 40
  • 76
keont
  • 653
  • 1
  • 9
  • 26

1 Answers1

3

in solution.pl, try

:- ensure_loaded('c:/Path').

or, if the source in c:/Path has a module directive - that is, it begins with :- module(name, [exported/arity, ...]).

:- use_module('c:/Path').
CapelliC
  • 59,646
  • 5
  • 47
  • 90
  • I was missing the :- part. Like, I took it for granted, I thought it was like a prompt, duno why though. Thanks a lot, really frustrating knowing the code and not using it properly. – keont Apr 12 '16 at 14:25