Thanks for your bug report, but please could you provide more
information. Perhaps a reference to a precise definition of
the cut, and an example to illustrate how the mini Prolog
implementation fails to meet that specification.
| Hello, we used Hugs' Prolog Demo as a base for a project in Programing
| Languages, and found out that the cut implementation is wrong.
| ...
| And here it is our version, that we think is correct:
|
| ------------------------------------------------------------------
| prove :: Database -> [Term] -> [Subst]
| prove db gl = solve 1 nullSubst gl []
| where
| solve :: Int -> Subst -> [Term] -> Stack -> [Subst]
| solve n s [] ow = s : backtrack n ow
| solve n s (g:gs) ow
| | g == theCut = solve s gs (cut2 (1 + numberOC gs) ow) --
|Changed
| | otherwise = choose n s gs (alts db n (app s g)) ow
Your proposed fix doesn't look correct to me. It doesn't even seem
to be type correct; the line that tests for cuts calls solve with
only three parameters, and the first is a Subst not an Int. Did you
try running this?
All the best,
Mark