Re: arithmetic_function (SWI)
- From: Jan Wielemaker <jan@xxxxxxxxxxxxxxxxxxx>
- Date: 09 Mar 2006 11:54:43 GMT
On 2006-03-09, Mauro Di Nuzzo <picorna@xxxxxxxxx> wrote:
Hi All.
This is an issue regarding arithmetic_function/1 predicate under SWI Prolog.
Suppose I define a new arithmetic function, namely a constant c/0, in this
way
:- arithmetic_function(c/0).
c(10).
Consider no changes in the context module when I consult it from the
toplevel.
Then I try:
?- X is c*2.
X = 20
That's ok. But I should have written:
?- c(Y).
Y = 10
So I can really access the predicate c/1. Instead, for SWI builtin
arithmetic function, this is not the case.
In fact, this happens:
?- Z is e.
Z = 2.71828
?- e(E).
ERROR: undefined procedure: e/1
So it seems that predicate e/1 associated with arithmetic function e/0 it is
asserted elseWHERE.
Finally, my question, WHERE?
Nowhere. All built-in arithmetic functions are connected to C-functions
using some internal interface (see pl-arith.c). One of these exploits a
call-back to Prolog to make predicates available as functions.
In other words, how can I handle arithmetic functions so that associated
predicates (with arity + 1) are, let's say, invisible?
You can't. You can put them in a module though.
--- Jan
.
- Follow-Ups:
- Re: arithmetic_function (SWI)
- From: Mauro Di Nuzzo
- Re: arithmetic_function (SWI)
- References:
- arithmetic_function (SWI)
- From: Mauro Di Nuzzo
- arithmetic_function (SWI)
- Prev by Date: Re: How is SWI-Prolog pronounced?
- Next by Date: Re: How is SWI-Prolog pronounced?
- Previous by thread: arithmetic_function (SWI)
- Next by thread: Re: arithmetic_function (SWI)
- Index(es):
Relevant Pages
|
|