Subject: [SWIPL] Help w/module loading

From: scritch mephisto <[email-masked]>
Date: Mon, 13 Aug 2001 11:38:01 -0700 (PDT)

Howdy,

Brand new to Prolog, I need a little hand holding.  Basically, I
need the modulus operator (mod).  Can someone explain the following
interaction?

First of all, here is my .plrc (note, autloading is on and verbose).
:- set_prolog_flag(autoload, true).
:- set_prolog_flag(verbose_autoload, true).

And, here is some interactive Prolog:
?- help(mod).
%  library(helpidx) compiled into help_index 0.13 sec, 125,484 bytes
% /usr/lib/swi-prolog/library/help compiled into online_help
0.14 sec, 138,868 bytes
% /usr/lib/swi-prolog/library/backcomp compiled into backward_compatibility
0.00 sec, 3,812 bytes
% /usr/lib/swi-prolog/library/quintus compiled into quintus
0.02 sec, 11,772 bytes
+IntExpr1 mod +IntExpr2
[snipped]
Yes

?- 5 mod 2.
ERROR: Undefined procedure: mod/2

?- 2 = 17 mod 5.

No

?- 2 is 17 mod 5.

Yes

Commentary:
Ok, autoloading of help functions worked, so I know autload is on.
However, why didn't "5 mod 2" force an autoload?  The next two
lines is another area of confusion, but I would be grateful for
an explanation.  The first is a predicate, no?  The second is an
assignment?  To a constant?!

What module is "mod" in?  Given a function name, is there a
mechanism to return the path of a module in which it is defined?

Thanks, and sorry I couldn't find this in the manual on my own...

(Since the first draft of this message, I figured out:
X = 5 mod 2.

But then why does this similar example not work:
min(10, X).

Thanks

_______________________________________________________
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/