PARLOG addendum for C-Prolog versions (again)

Jeremy West west at uts.am.reading.UUCP
Fri Jul 12 15:22:21 AEST 1985


Keywords:
Xpath: reading uts.am gateway.cs
Xref: ukc net.lang.prolog:497 net.sources.bugs:389

The built_in/1 predicate I distributed earlier fails to treat
arithmetic predicates correctly. If they are not expanded (by use
of expand_exprs/2 (sometimes expanded_exprs/2) they will be arguments
to is/1. This was why I commented them out of my earlier posting.
If expanded, however, they are translated into predicates of the form
$<name>/<arity+1>. These will not be recognised by built_in/1 as it
stands.

Here is the corrected version of the arithmetic ops list:

/*++++++++

% I don't think it's necessary to define the arith ops as built-in
% unless you use the expansion of expressions.

% You could simply use this to declare all '$' routines as system:
built_in( T ) :-
	functor(T, F, A),
	name(F, ["$"|L]).

% Otherwise:

built_in(( '$+'(A, X) )).
built_in(( '$-'(A, X) )).
built_in(( '$\'(A, X) )).
built_in(( $exp(A, X) )).
built_in(( $log(A, X) )).
built_in(( $log10(A, X) )).
built_in(( $sqrt(A, X) )).
built_in(( $sin(A, X) )).
built_in(( $cos(A, X) )).
built_in(( $tan(A, X) )).
built_in(( $asin(A, X) )).
built_in(( $acos(A, X) )).
built_in(( $atan(A, X) )).
built_in(( $floor(A, X) )).
built_in(( '$+'(A, B, X) )).
built_in(( '$-'(A, B, X) )).
built_in(( '$*'(A, B, X) )).
built_in(( '$/'(A, B, X) )).
built_in(( $mod(A, B, X) )).
built_in(( '$/\'(A, B, X) )).
built_in(( '$\/'(A, B, X) )).
built_in(( '$<<'(A, B, X) )).
built_in(( '$>>'(A, B, X) )).
built_in(( '$//'(A, B, X) )).
built_in(( '$^'(A, B, X) )).

-----*/


Jerry
-----
  west%rdg.cs at ucl-cs.ARPA       | Dept of Computer Science,
  west at cs.reading.UUCP          | University of Reading,
  west at uk.ac.reading.cs (JANET) | READING, RG6 2AX, U.K.



More information about the Comp.sources.bugs mailing list