Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!Germany.EU.net!Munich.Germany.EU.net!ecrc!news
From: joachim@ecrc.de (Joachim Schimpf)
Subject: Re: [Q] - colon operator (:) in SWI Prolog
Message-ID: <D6v2xp.A0t@ecrc.de>
Sender: news@ecrc.de
Reply-To: joachim@ecrc.de
Organization: European Computer-Industry Research Centre GmbH, Munich, Germany
References: <10APR95.11550162.0236@UNBVM1.CSD.UNB.CA>
Date: Tue, 11 Apr 1995 08:15:25 GMT
Lines: 39

In article 007F2993@utdallas.edu, ryoung@utdallas.edu (Young U . Ryu) writes:
>
>While reading the SWI Prolog manual (and checking with current_op/3), I found
>':' is defined as an operator, but could not find its use or definition.
>
>     :- op(600, xfy, ':')
>
>Can anyone explain what's the use of it?
>

Operator declarations just say something about _syntax_. This one just
allows you to write a:b instead of :(a,b) and saves you three keystrokes.
That's all! It does not attach any magical meaning to the colon, so
a:b is just the compound term :(a,b) and per se just as meaningless
as foo(a,b).


And in article 0236@UNBVM1.CSD.UNB.CA, Dave Sharpe <J9PX@UNB.CA> writes:
>
>You maybe right about the namespaces. However, I use the colon
>as a component seperator for tuples (e.g. [1:2 , 1:3] is a list of
>2 pairs).
>
>I picked this up from reading someone elses code. My question is
>am I using the colon naivly?  I do not want any namespace
>checking, plus I do want portable code (it works for SWI and Quintus).
>

Don't worry. As long as you don't pass your colon-terms to built-in
predicates that interpret them in a special way, it is _you_ who
decides what your colon-terms "mean".


---------------------------------------------------------------------------
 Joachim Schimpf                                 Email   joachim@ecrc.de 
 European Computer-Industry Research Centre      Phone   +49 89 92699 111
 Arabellastrasse 17, D-81925 Munich, Germany     Fax     +49 89 92699 170


