home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!edcastle!aiai!ken
- From: ken@aiai.ed.ac.uk (Ken Johnson)
- Newsgroups: comp.lang.prolog
- Subject: Re: SICStus Prolog singleton warnings slow down while consulting a file
- Keywords: singleton
- Message-ID: <7240@skye.ed.ac.uk>
- Date: 18 Aug 92 17:16:03 GMT
- References: <1992Aug17.172126.19111@watson.ibm.com> <5100@sersun1.essex.ac.uk>
- Followup-To: comp.lang.prolog
- Organization: Bugs-R-Us
- Lines: 30
-
- In article <5100@sersun1.essex.ac.uk> palmm@essex.ac.uk (Palmer M J)
- writes:
-
- # Some systems (e.g. Qunitus Prolog) allow you to use the form _VarName.
- # This is still an anonymous variable but with a name. You might like to
- # try this.
-
- Forgive my pedantry, but (in Edinburgh Prolog) ocurrences of variables
- with the same name are equal to each other, even if the name begins with
- _. So _A and _B, etc., are not anonymous variables. The point is that
- the singleton variable check is not applied to such variable names.
-
- Therefore such code as
-
- different(A,A) :-
- !,
- fail.
-
- different(_A,_B).
-
- does not generate a singleton error message. (NB This predicate is not
- the best way to test whether _A and _B are different, unless you want to
- unify them if possible. It's just a way to illustrate the magical
- property of the variable names _A and _B.)
-
- --
- //// Advice to dieters: //// Ken Johnson, A I Applications Institute
- //// Never eat more than //// 80 South Bridge, EDINBURGH EH1 1HN
- //// you can carry. //// E-mail ken@aiai.ed.ac.uk
- //// -- Miss Piggy //// phone 031-650 2756 fax 031-650 6513
-