On 2009/10/13, at 14:45, leledumbo wrote:
> Either I don't understand the explanation in the docs or what, one
> thing for
> sure I can't do it correctly. I have:
>
> % module queue
> :- module(queue,[empty/1,enqueue/3,dequeue/3,member/2,add_list/3]).
>
> % module set
> :-
> module(set,[empty/1,member/3,member2/3,delete_if_exists/
> 3,add_if_not_exists/3,
> union/3,subset/2,intersection/3,diff/3,equal/2]).
>
> % main module
> :- use_module([queue,set]).
>
> when the main module is consulted, swi-prolog says:
> ERROR: Cannot import set:empty/1 into module user: already imported
> from
> queue
>
> The definition are equal (i.e.: empty([]).), could that be the
> problem?
No. You're getting an error because the use_module/1 directive both
loads the module files and imports their exported predicates. The
predicates are imported into the current module. For example, if you
type the query "use_module([queue,set])." at the Prolog prompt, the
current module is usually the module "user". Thus, the error results
from trying to import predicates with the same name into the same
module.
> Should it be possible to call each with a qualified name?
Depends. Do you want instead to load the two module files without auto-
importing their exported predicates?
Cheers,
Paulo
-----------------------------------------------------------------
Paulo Jorge Lopes de Moura, PhD
Assistant Professor
Dep. of Computer Science, University of Beira Interior
6201-001 Covilhã, Portugal
Office 3.18 Ext. 3276
Phone: +351 275319891 Fax: +351 275319899
Email: <mailto:
pmoura@...>
Home page: <
http://www.di.ubi.pt/~pmoura>
Research: <
http://logtalk.org/> Blog: <
http://blog.logtalk.org/>
-----------------------------------------------------------------
_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog