Subject: please, answer on my FAQ (fwd)

From: Dmitry Kuzmin <[email-masked]>
Date: Mon, 27 Nov 2000 16:27:03 +0300 (MSK)

Sorry for sending its all to Jan :) May be on promise me ?

see \|/

---------- Forwarded message ----------
Date: Mon, 27 Nov 2000 16:19:14 +0300 (MSK)
From: Dmitry Kuzmin <[email-masked]>
To: [email-masked]
Subject: please, answer on my FAQ

About flag/3:

in SWI-Prolog 3.4.2 Reference Manual on flag/3 I not found info about
lifetime of flag or info about how see current flags in program
(monitoring, erase) (found only use). Please, add some comments for this
(I be afraid that programs with flag may grow and grow).

And how about
	succeeds_n_times((...,succeeds_n_times((...),Times2),...),Times1)
etc.

	And on example:
	how this work ?
	 
I use it how ->
I do it like ->

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% times counters
%--------------------------------------------------------------------------
% count +Goal success in ?Times or try +Goal +Times
n_times(Goal, Times) :-
	gensym(n_times,Name),
	flag(Name, _N, 0),!,
	repeat,
	( Goal,
		flag(Name, N, N+1),
		fail
	; flag(Name, Times, _N)
	).
%--------------------------------------------------------------------------
% try +Goal +Times times, successes count in Success
Success try_n_times(Goal, Times, Success) :-
	gensym(try_n_times,Name),
	flag(Name, _, 0),!,
	repeat,
	( Goal,
		flag(Name, N, N+1),
		flag(Name, Times, Times),
		Success=Times
	; flag(Name, Success, 0)
	).
%--------------------------------------------------------------------------

Sorry, if I harm you worktime or You don't undestand me. 

Good luck.

[email-masked]