[m-dev.] stop flag in collect

Erwan Jahier Erwan.Jahier at irisa.fr
Fri Aug 24 21:24:53 AEST 2001


Hi,

The current type declarations of the filter predicate that the user needs to 
define to specify a monitor with collect is as follows:

	:- pred filter(event, accumulator_type, accumulator_type, 
						stop_or_continue).
	:- mode filter(in, acc_in, acc_out, out) is det.

The fourth argument is used to be able to stop the monitoring process before
the end of the execution is reached. Coming to think about that, I was
wondering whether it would be better to remove this boolean flag and to make
filter semidet instead; i.e., to have:

	:- pred filter(event, accumulator_type, accumulator_type).
	:- mode filter(in, acc_in, acc_out) is semidet.

then, instead of writing something like:

	filter(Event, N, N+1, Flag) :-
		if depth(Event) < 100 then Flag = continue else Flag = stop.

we would have:

	filter(Event, N, N+1) :-
		depth(Event) < 100.

And so on.

Do some people there wish to give me their opinion on that?

ps: I also plan to rename collect into foldt, and filter into collect. I think
those names are much better because: 1) filter usually refers to something else
in the functional programming word and 2) collect^H^H^H^H^H^H foldt is really a
special kind of fold operating on a list of events.  

-- 
R1.


--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list