thom@tuhold (Thom Fruehwirth) (08/18/88)
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. thom fruehwirth
goldfain@osiris.cso.uiuc.edu (08/29/88)
> 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