From jan@swi.psy.uva.nl  Fri Oct 15 09:02:53 1999
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.114.15])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id JAA07868;
	Fri, 15 Oct 1999 09:02:53 +0200 (MET DST)
Received: (from jan@localhost)
	by gollem.swi.psy.uva.nl (8.9.3/8.9.3) id JAA29667;
	Fri, 15 Oct 1999 09:04:07 +0200
Date: Fri, 15 Oct 1999 09:04:07 +0200
Message-Id: <199910150704.JAA29667@gollem.swi.psy.uva.nl>
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Subject: Re: Fw: Implementation of assert in SWI
To: "Eric Neufeld" <eric@cs.usask.ca>, <prolog@swi.psy.uva.nl>
In-Reply-To: Eric Neufeld's message of Thu, 14 Oct 1999 18:24:08 -0600
Phone: +31 - 20 - 525 6121

>  SICStus Prolog behaves as follows:
>  
>  | ?- assert(a(1)).
>  
>  yes
>  | ?- a(X), Y is X + 1, assert(a(Y)).
>  
>  X = 1,
>  Y = 2 ? ;
>  
>  no
>  | ?- a(X), Y is X + 1, assert(a(Y)).
>  
>  X = 1,
> Y = 2 ? ;
>  
>  X =2,
> Y =3 ? ;
>  
>  no
> 
> That is, the choice points generated by a(X) are just those that exist
> when a(X) is first called. SWI continues ad infinitum after the second
> query. Bug or feature? Thanks. I am using SWI in a 4th yr AI class.

Neither, I would say.  As most older Prolog implementations, SWI-Prolog
uses the `direct-update view' for the database, while the ISO standard
wants the `logical update view' (as SICStus does). 

Sooner or later SWI-Prolog will implement the ISO logical update view too.

Generally, only use asserta/1 to predicates with active choice-points
if the ordering of the clauses is of no importance.

	Regards --- Jan

