[m-dev.] Re: for review: function def's for single out det mode library predicates
Lee Naish
lee at cs.mu.OZ.AU
Fri Apr 30 17:20:33 AEST 1999
Ralph Becket <rwab1 at cam.sri.com> writes:
> > :- func list__det_head(list(T)) = T.
> >
> > :- func list__det_tail(list(T)) = list(T).
I think the default/shorter name for these functions should be the det
forms. Either list__head should be det, or use list__hd.
> > :- func list__filter(pred(X), list(X)) = list(X).
> > :- mode list__filter(pred(in) is semidet, in) = out is det.
There should be some discussion of whether to use semidet preds or
functions returning booleans in this context. The former is more
natural in the LP+FP context I think, but it would be nice to have
standard functions in FP the same in Mercury. There are probably some
other instances of this issue. One possibility is to have something
like maybe_func, called bool_func?, which takes a semidet pred mode in and
returns a bool function.
> > :- func pair(T1, T2) = pair(T1, T2).
I find it useful to have this in other modes also (best add a pred version
with appropriate modes).
The rest looks beaut.
lee
--------------------------------------------------------------------------
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