Path: utzoo!utgpu!attcan!uunet!mcvax!enea!kth!draken!ttds!jonasn From: jonasn@ttds.UUCP (Jonas Nygren) Newsgroups: comp.lang.prolog Subject: The double-cut. Message-ID: <1162@ttds.UUCP> Date: 28 Jul 88 21:50:36 GMT Reply-To: jonasn@ttds.UUCP (Jonas Nygren) Organization: The Royal Inst. of Techn., Stockholm Lines: 30 Maybe it's presumptuous of a novice Prolog programmer like myself to come with suggestions on how to improve the language but somehow you have to find out if your'e dead wrong or if your ideas have any substance. Here we go. When trying to write procedural code for a simple curvplotting routine I often encountered problems with backtracking over system-calls. The remedy for this was code like: a :- !, b, !, c, !, d, !, e, !. to avoid backtracking of goals a,b,c,d,e but this looks rather awkward. If you instead could write something like: a :- !!, b, c, d, e. with the same effect it wouldn't look to bad, I call it the double-cut. Naturally the double-cut could be placed later in the goal chain, e g: a :- b, c, !!, d, e. to achieve the equivalence of: a :- b, c, !, d, !, e, !. What do you think of the double-cut: 1 is it any good? 2 are there any Prolog-variants with similar functionality? 3 would it provide means for the Prolog-implementor to do more optimization than without it? 4 is there a better way to achieve the same result? /jonas