Re: [swipl] Use arithmetic_function/1 inside a module

Jochem Liem <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CABryw9QFbjQ9qHxH-W5=JViFRkSJogmFJcyBmcmZUzUBaYpB5w@mail.gmail.com>
Hi Wouter! :)

Why are you using: 'X is xsd_div(7, 2).' ?
You can just do 'test_arithmetic:xsd_div(7,2,X)'.

?- test_arithmetic:xsd_div(7,2,X).
X = 3.

Cheers,
Jochem

On Tue, Apr 1, 2014 at 8:00 PM, Wouter Beek <[email protected]> wrote:
> 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
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog



-- 
Jochem Liem, PhD
http://jochemliem.wordpress.com
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.