home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / prolog / 1555 < prev    next >
Encoding:
Internet Message Format  |  1992-08-18  |  1.6 KB

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