[m-rev.] for review: make get_functor handle existential types
Zoltan Somogyi
zs at cs.mu.OZ.AU
Mon Dec 13 16:14:55 AEDT 2004
On 13-Dec-2004, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> > library/list.m:
> > Add two general-purpose predicates, all_true and all_false,
> > for use in the other library modules.
>
> Are these really that useful?
I think so.
> > +list__all_true(_P, []).
> > +list__all_true(P, [X | Xs]) :-
> > + P(X),
> > + list__all_true(P, Xs).
> > +
> > +list__all_false(_P, []).
> > +list__all_false(P, [X | Xs]) :-
> > + not P(X),
> > + list__all_false(P, Xs).
>
> Is there any efficiency difference between the above and these?
>
> all [X] ( member(X, Xs) => P(X) )
> and
> all [X] ( member(X, Xs) => not P(X) )
Yes. Backtracking is slower than iteration.
> Stylistically, I prefer the latter.
Questions of taste are not all that useful as subjects of discussion.
Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list