[swipl] Use arithmetic_function/1 inside a module

Wouter Beek <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAE1un7M4fN=nZ6QGKxCZKtgvKB14cD2f4GMuMniyo-zZj5LX=A@mail.gmail.com>
Hi list,

Is it possible to define an arithmetic function inside a module?

Sample file:
~~~{.pl}
:- module(test_arithmetic_1, []).
:- use_module(library(arithmetic)).
:- arithmetic_function(xsd_div/2).
xsd_div(X, Y, Z):-
  Z is floor(X / Y).
~~~

Usage:
~~~
swipl -s test_arithmetic_1.pl
?- X is xsd_div(7, 2).
Error: Arithmetic: `xsd_div(7,2)' is not a function
~~~

I have no problem with using arithmetic functions defined in non-module files.

---
Cheers!,
Wouter.

E-mail: [email protected]
WWW: www.wouterbeek.com
Tel.: 0647674624
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.