Christian Wirth wrote: > Hi, > > how can i define a cut that allows backtracking over the current > predicate but not over another predicate ? > example: > > pred(aPred(X)) :- call(X). > pred(X) :- anotherCall(X). > > i now want to define a cut that creates all solutions for call(X), if > the first perdicate gets matched, but it should prevent matching the > other one. > I'm currently using pred(X) :- > functor(X,F,A),not(F==aPred),anotherCall(X), but i want to replace this > because speedup is very essential. > > .. hope this is possible. It sounds like all you want is pred(aPred(X)) :- !, call(X). pred(X) :- anotherCall(X). You can find these basics in any introductory Prolog text. We have a few links on the web site http://eclipse-clp.org/links.html -- JoachimReceived on Sat May 15 2010 - 11:22:23 CEST
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET