Subject: Re: Fw: Implementation of assert in SWI

From: Jan Wielemaker <[email-masked]>
Date: Fri, 15 Oct 1999 09:04:07 +0200

>  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