🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #651

Re: SICStus Prolog singleton warnings slow down while consulting a file

#651
From: Gregory Sidebottom
Date: Mon, 17 Aug 1992 21:04
40 lines
1937 bytes
In article <1992Aug17.172126.19111@watson.ibm.com> rah@ybrig.zurich.ibm.com (Ralf Hauser) writes:

   While porting a big C-Prolog program to SICStus Prolog, I encounter
   the following problem:

   To make the program readable, I gave a name to many variables which
   are essentially _ (don't care). 

That is a good thing to do.

   When (re)consulting my program,
   every time many screens of such warnings are produced which
   slow down the testing and programming annoyingly.

   Does anybody know, how to suppress these warnings or to
   maintain the same expressivity of code without creating those
   "singleton variables".

Try starting your singlton variables with the underscore symbol.  This
tells the compiler that you know it's a singlton variable, even though
you want to give it a meaningful name.  So you can write:

p(_SomethingMeaningful).

and not get a warning in Sicstus.  But note that variables beginning
with an underscore are not anonymous--the two variable symbols in:

p(_X) :- q(_X).

denote the same variable.  Whereas in:

p(_) :- q(_).

the underscores denote two distinct variables.

Greg
-- 
Greg Sidebottom,                                      | There's not a word that
Expert Systems Laboratory, Centre for Systems Science | goes here that rhymes
Simon Fraser University, Burnaby BC V5A 1S6, Canada   | with anything. -CVB
Technical Details
Message-ID: <1992Aug17.210426.14213@cs.sfu.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!fornax!gregory
References: <1992Aug17.172126.19111@watson.ibm.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.prolog
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!fornax!gregory
From: gregory@cs.sfu.ca (Gregory Sidebottom)
Subject: Re: SICStus Prolog singleton warnings slow down while consulting a file
In-Reply-To: rah@ybrig.zurich.ibm.com's message of Mon, 17 Aug 92 17:21:26 GMT
Message-ID: <1992Aug17.210426.14213@cs.sfu.ca>
Organization: CSS, Simon Fraser University, Burnaby, B.C., Canada
References: <1992Aug17.172126.19111@watson.ibm.com>
Date: Mon, 17 Aug 1992 21:04:26 GMT
Lines: 40