Article View: comp.lang.prolog
Article #3615Re: Double Cut - One is enough
From: goldfain
Date: Sun, 28 Aug 1988 21:57
Date: Sun, 28 Aug 1988 21:57
23 lines
1470 bytes
1470 bytes
> thom@tuhold (Thom Fruehwirth) writes in comp.lang.prolog :
> /* ---------- "Double Cut - One is enough" ---------- */
> The more you program in Prolog, the less cuts you will need.
> Also, at most one cut per clause is enough, as there is a
> simple equivalence preserving program transformation:
> P:- G1,!,G2,!,Gs. <=> P:- G1,!,G2Gs. G2Gs:- G2,!,Gs.
Hmmm. My personal experience has not been the same. I think I use more cuts
than I did years ago.
I also don't see why the following has any real relevance to the idea of
cut-reduction :
a :- b, !, c, !, d. <=> a :- b, !, cd. cd :- c, !, d.
It looks to me as though you've traded 2 cuts for 2 cuts - hardly a
savings. Sure, you've achieved a goal of only one cut per clause, but the
code is now worse than it was before - runs slower and as often as not less
understandable than the previous version.
Sorry to be so flamey. - Mark Goldfain
Technical Details
Message-ID:
<7000004@osiris.cso.uiuc.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!uwvax!oddjob!uxc!uxc.cso.uiuc.edu!osiris.cso.uiuc.edu!goldfainReferences:
<1162@tuhold>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!uwvax!oddjob!uxc!uxc.cso.uiuc.edu!osiris.cso.uiuc.edu!goldfain From: goldfain@osiris.cso.uiuc.edu Newsgroups: comp.lang.prolog Subject: Re: Double Cut - One is enough Message-ID: <7000004@osiris.cso.uiuc.edu> Date: 28 Aug 88 21:57:00 GMT References: <1162@tuhold> Lines: 23 Nf-ID: #R:tuhold:1162:osiris.cso.uiuc.edu:7000004:000:959 Nf-From: osiris.cso.uiuc.edu!goldfain Aug 28 16:57:00 1988