[net.lang.prolog] Prolog Hacker Tricks

emneufeld@watdragon.UUCP (emneufeld) (04/02/86)

If there is already a book on this subject, someone please let me know.  Prolog
is wonderful, but it has its unique problems; some of which can only be dealt
with by a bit of hacking.  The following trick was shown to me by a friend:

        To save space, use

                not ( not ( predicate (X ...))))

        in place of `predicate (X ... )' where you are interested just in the
success of the predicate and not any values it might return.  (Why does it work?
If the predicate succeeds, the meta-predicate not fails, bindings are undone and
stack space is freed.  Second not returns success.  If the predicate fails,
nothing is saved, but you get the answer you wish.)

        Send your favourite hack.

ylee@uiucdcs.CS.UIUC.EDU (04/06/86)

>                 not ( not ( predicate (X ...))))

What if `predicate (X ... )' loops?