[m-dev.] for review: --stack-trace-higher-order

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Nov 1 20:39:36 AEDT 1998


On 01-Nov-1998, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> library/list.m:
> 	Add a new predicate list__filter_any for use by llds_out.m.
...
> +	% list__filter_any(Pred, List) takes a closure with one input argument
> +	% and for each member of List `X', calls the closure. If call(Pred, X)
> +	% succeeds for any member of List, list__filter_any succeeds
> +	% immediately. If call(Pred, X) fails on all members of the list,
> +	% list__filter_any fails.
> +:- pred list__filter_any(pred(X), list(X)).
> +:- mode list__filter_any(pred(in) is semidet, in) is semidet.
...
> +list__filter_any(P, [H|T]) :-
> +	( call(P, H) ->
> +		true
> +	;
> +		list__filter_any(P, T)
> +	).

and then in llds_out.m:
> +			LabelHasStackLayout = lambda([Label::in] is semidet, (
> +				set_bbbtree__member(Label, StackLayoutLabels)
> +			)),
> +			( list__filter_any(LabelHasStackLayout, Labels) ->
				...

I think it would be clearer to just write that using list__member:

			(
				list__member(Label, Labels),
				set_bbbtree__member(Label, StackLayoutLabels)
			->
				...

The same point applies to any use of list__filter_any.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list