[m-dev.] for review: add promise_only_solution/1 to std_util.m
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Nov 6 16:30:48 AEDT 1998
On 06-Nov-1998, Peter Schachte <pets at cs.mu.OZ.AU> wrote:
> Now that I think about it, there really should be wrappers for all of
> these purposes:
>
> to promise there is at most one solution,
> to promise there is at least one solution, and
We already have a perfectly good way of promising at least one solution:
(if p(...) then ... else error("p failed")).
This mechanism is better than promise_only_solution in
a number of ways: it can be checked at runtime
(whereas promise_only_solution can't be checked at all,
except with a theorem prover...),
and it's more polymorphic.
> to promise there is exactly one solution,
For that case, you can just combine the two.
> > (4)
> > Even if we did, the set of modes still wouldn't be complete;
> > e.g. we should add `uo' modes, etc.
>
> Oh, yeah, those should be there, too. That'll double the number of
> modes.
Next add in the
out(unique('-'(ground, unique)))
mode, for the case where the predicate returns a pair of items,
only one of which is unique...
As you can see there are quite a few possibilities.
--
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