A. C. Brett firstname.lastname@example.org
Department of Linguistics
University of Victoria
42 0 -6Note that the negative sign, -, must immediately precede the number it is marking as negative; otherwise, if there is a space, the sign is construed by the interpreter as representing the subtraction operator.
2.54 0.625 -24.68Note that numbers between 0.0 and 1.0 must be represented with a zero digit preceding the decimal point. Also, if an integer is to be represented as a floating point number, then there must be a zero digit following the decimal point.
Floating point numbers may also be represented using an exponential notation such as is shown in the following examples.
2.99E+10 1.624E-27where E+10 in the first example means that the number preceding it is to be multiplied by 10 raised to the power 10.
X is 3 + 4 . % X is (instantiated with) the sum of 3 and 4 . X is 3 - 4 . % X is (instantiated with) the difference of 3 and 4 . X is 3 * 4 . % X is (instantiated with) the product of 3 and 4 . X is 3 / 4 . % X is (instantiated with) the division of 3 by 4 .Thus, arithmetic expressions are represented with the operator sign in an infix position relative to its operands; that is, it appears between, and splits the numbers operated upon.
Arithetic expressions can also be written with the operator sign in the prefix position as follows:
X is +(3, 4). X is *(3, 4).which is close to a verbatim translation of English sentences such as "X is the sum of 3 and 4" with "the sum" translated as the operator sign, +, "of" translated as the left parenthesis, (, and with "and" translated as a comma.
The prefix position of the operator sign is also consistent with the position of the principal functor name relative to its arguments in the representation of a Prolog structure. In this connection, note that the arithmetic operator signs are actually special atoms that name system predicates which perform the arithmetic operations.
|Linguistics 482||Prolog Introductory Notes||Top of Page|