[mercury-users] Getting 'any' insts to ground
Peter Schachte
pets at students.cs.mu.oz.au
Tue Nov 11 20:45:34 AEDT 1997
On Tue, 11 Nov 1997, Lee Naish wrote:
> >Do you have any suggestions for a better name?
>
> I suggest a semidet procedure only_solution and a det procedure
> one_and_only_solution.
I implemented such a predicate in Prolog once. I called it 'the', as I
thought that word pretty well summed up the idea of "one and only." I
suppose you could have:
:- pred the(pred(T), T).
:- mode the(pred(out) is multi, out) is det.
:- mode the(pred(out) is nondet, out) is semidet.
if that's a valid combination.
> Yes, you would want to combine the generation of solutions and the
> checking for the right number (as soon as you got two different
> solutions you could complain).
That's just how my Prolog implementation worked. Of course, it used assert,
so it wasn't blazingly fast. Still, even in (non-conservative GC grades of)
Mercury, you'll have to deep copy the term, so it's not going to be
blazingly fast in Mercury, either.
-Peter Schachte | Some lies are so well disguised to resemble
pets at cs.mu.OZ.AU | truth, that we should be poor judges of the
http://www.cs.mu.oz.au/~pets/ | truth not to believe them. -- Anonymous
PGP key available on request |
More information about the users
mailing list