🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.prolog
Article #580

Prolog Hacker Tricks

#580
From: emneufeld
Date: Wed, 02 Apr 1986 20:09
15 lines
1245 bytes
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.
Technical Details
Message-ID: <769@watdragon.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!watnot!watdragon!emneufeld

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site watdragon.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!watnot!watdragon!emneufeld
From: emneufeld@watdragon.UUCP (emneufeld)
Newsgroups: net.lang.prolog
Subject: Prolog Hacker Tricks
Message-ID: <769@watdragon.UUCP>
Date: Wed, 2-Apr-86 15:09:39 EST
Article-I.D.: watdrago.769
Posted: Wed Apr  2 15:09:39 1986
Date-Received: Sat, 5-Apr-86 03:31:29 EST
Distribution: net
Organization: U of Waterloo, Ontario
Lines: 15