[Fwd: Re: Any Prolog language lawyer out there?]

-------- Original Message -------- Subject: Re: Any Prolog language lawyer out there? Date: 19 Oct 2004 14:59:26 GMT From: Jan Wielemaker jan@ct.xs4all.nl Reply-To: jan at nospam.swi.psy.uva.nl Organization: SWI, University of Amsterdam Newsgroups: comp.lang.prolog References: 41750912.8040102@cs.unipr.it 1098196164.417498@seven.kulnet.kuleuven.ac.be
In article 1098196164.417498@seven.kulnet.kuleuven.ac.be, Bart Demoen wrote:
Roberto,
Am I correct if I say that all the 6 tested systems are /not/ violating the ISO Prolog standard because unary plus is not mentioned in its Table 7 (p. 19) and thus its presence and priority are implementation-defined? All the best,
Roberto
P.S. Standard or not standard, I find all this quite striking.
The + not figuring in ISO as fy, makes the situation murky. But - is in ISO as 200 fy. And one finds differences like:
In SICStus:
| ?- prolog_flag(language,_,iso). yes | ?- current_op(200,fy,-). yes | ?- functor(- 4,X,Y). X = -4, Y = 0 ?
I think this is a mistake. Reading "Prolog, the standard", I find (p. 230) that an integer is an integer token, which is defined as a sequence of digits (besides binary, octal, etc). If this is really true, than negative numbers cannot be represented and only get their property when passed to one of the arithmetic predicates.
I think this is undesirable. For one thing, on engines using fixed with 2-complements representation (allowed!) one must write the smallest integer as (-2147483647-1) !? Also, one always needs is/2 to represent a negative integer. So, the tokeniser should deal with '-'{digit}+. The situation for + is a bit less clear as it is not _needed_ to represent positive integer terms.
Indeed a bit depressing ...
Cheers --- Jan
participants (1)
-
Roberto Bagnara