🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #2543

Re: Prolog debugging

#2543
From: bsmith
Date: Sun, 08 Feb 1987 22:37
29 lines
1988 bytes
Typo-caused errors in Prolog programs can be hard to find.  The errors fall
into two classes:

   (i)	in a predicate -- In the head of a clause, this causes the clause
	to be part of the definition of the wrong (possibly new) procedure.
	In the body, it causes a call to the wrong (and possibly undefined)
	procedure.

   (ii)	in a variable -- A typo can either make a variable name the same or
	not the same as another variable in the clause.  In either case, the
	misspelled variable gets the wrong binding.

Typos in punctuation and non-variable terms are easier to catch.  At least I
seldom have any problems with them.  Of course, the reader screams at me if
my parentheses or brackets don't match.  And, I tend to use longer names for
variables and predicates than for atoms or functors.

Style rules, as in Quintus Prolog, catch lots of these.  In particular,

   (i)	clauses defining a procedure should come together in a file -- A typo
	in the head of a clause may violate this rule, either by not matching
	the clauses around it or by matching a clause somewhere else.

   (ii)	the anonymous variable '_' should be used for singleton variables --
  	A misspelled variable name that makes a non-singleton variable into a
	singleton variable violates this rule.

Of course they don't catch everything.  (And, yes, if you're annoyed by them,
it is possible to turn them off.)
Technical Details
Message-ID: <2693@iuvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!ihnp4!inuxc!iuvax!bsmith
References: <445@primerd.uucp> <737@rpics.RPI.EDU>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!ihnp4!inuxc!iuvax!bsmith
From: bsmith@iuvax.UUCP
Newsgroups: comp.lang.prolog
Subject: Re: Prolog debugging
Message-ID: <2693@iuvax.UUCP>
Date: Sun, 8-Feb-87 17:37:35 EST
Article-I.D.: iuvax.2693
Posted: Sun Feb  8 17:37:35 1987
Date-Received: Tue, 10-Feb-87 04:27:14 EST
References: <445@primerd.uucp> <737@rpics.RPI.EDU>
Reply-To: bsmith@iuvax.UUCP (Bruce T. Smith)
Organization: Indiana University, Bloomington
Lines: 29
Keywords: prolog, errors, misspelling, debugging