Subject: Re: the meaning of ";"

From: Jan Wielemaker <[email-masked]>
Date: Fri, 21 May 1999 15:48:39 +0200

On Fri, 21 May 1999, Fred Dushin wrote:
>Do you mean '()' or '(t_1, ..., t_n)'?
>
>In general, () is used by the prolog parser to group terms
>using infix operators (',', ';', etc.)  Jan may have
>a better answer to this.
>
>An interesting observation:  ',' is a *binary* functor,
>despite its occurrence in terms like '(t_1, ..., t_n)'.
>Internally, such a term has the following represenatation:
>
>	','( t_1, ','( t_1, ..., ','( t_{n-1}, t_n )...))
>
>Maybe Jab can clarify for other cases, like ';' or user-defined
>operators.
>
>-Fred

() has two meanings.  If proceeded by a functor (i.e. there is
an atom in front of it without a space betweeen the atom and the
'(' as in 'foo(', it delimits an argument list.  The arguments
themselves are separated by the ','.

In all other cases, () takes and expression and reduces the operator
precedence of it to 0.  Effectively this deals with grouping, but it
can also be useful to deal with groups of 1 element: reduce an operator
to an atom to avoid a precedence conflict.

After being parsed, there is no way to tell how the term was written.
I.e. =:=(2,1+1) is the same as 2 =:= 1+1 is the same as 2 =:= (1+1),
etc.

	Regards --- Jan