From ok@atlas.otago.ac.nz  Mon Nov 20 03:04:23 2000
Received: from atlas.otago.ac.nz (atlas.otago.ac.nz [139.80.32.250])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id DAA19956
	for <prolog@swi.psy.uva.nl>; Mon, 20 Nov 2000 03:04:20 +0100 (MET)
Received: (from ok@localhost)
	by atlas.otago.ac.nz (8.9.3/8.9.3) id PAA10993;
	Mon, 20 Nov 2000 15:04:12 +1300 (NZDT)
Date: Mon, 20 Nov 2000 15:04:12 +1300 (NZDT)
From: "Richard A. O'Keefe" <ok@atlas.otago.ac.nz>
Message-Id: <200011200204.PAA10993@atlas.otago.ac.nz>
To: aikguitarist@usa.net, prolog@swi.psy.uva.nl
Subject: Re:  arithmetic exception

	numPos([], 0).
	numPos([Head|Tail], N):-integer(Head), Head>0, X is N-1, numPos(Tail,X).
	numPos([Head|Tail], N):-numPos(Tail,X).

Load that into SWI Prolog and it tells you:
	Warning: Singleton variables: [Head, N, X]

Head is forgivable here, but it is clear that N and X should have been
the same variable.  SICStus Prolog has essentially the same error message,
and so has Quintus Prolog.
	
	| ?- numPos([1,[2],3], 2).

SICStus Prolog says
    {INSTANTIATION ERROR: _78 is _75-1 - arg 2}
which is a little confusing, it means instantiation fault in argument 2 of
is(_78, _75-1), which is spot on correct.
Quintus Prolog words this a little better:
    ! Instantiation error in argument 2 of is/2
    ! goal:  _9649 is _9652-1
Both of these are pointing quite clearly to the X is N-1 subgoal,
telling us that N is unbound.

