Question about placement of cuts
- From: "brianna.laugher@xxxxxxxxx" <brianna.laugher@xxxxxxxxx>
- Date: Thu, 30 Aug 2007 03:16:09 -0000
Q1. Is there any difference (to Prolog) between these two styles of
code?
Type 1:
foo(A,B) :-
bar(A),
!,
baz(B),
!.
bar(a).
bar(b).
baz(y).
baz(z).
=======================
Type 2:
foo(A,B) :-
bar(A),
baz(B).
bar(a) :- !.
bar(b) :- !.
baz(y) :- !.
baz(z) : - !.
=======================
Q2.
I have a predicate similar to this:
% determine_sign(Pre,Post,Overall).
determine_sign(pos,neg,neg).
determine_sign(pos,pos,pos).
determine_sign(neg,pos,neg).
determine_sign(neg,neg,pos).
determine_sign(_,_,[]).
Maybe that last clause should actually be this?
determine_sign(Pre,Post,[]) :-
\+ is_member(Pre, [pos,neg]),
\+ is_member(Post, [pos,neg]).
Does that have the same effect as adding cuts to each definition?
thanks,
Brianna
.
- Follow-Ups:
- Re: Question about placement of cuts
- From: Markus Triska
- Re: Question about placement of cuts
- Prev by Date: Re: Prolog doesn't give multiple solutions to my goal.
- Next by Date: Re: Question about placement of cuts
- Previous by thread: Survey of indexing features for dynamic clauses
- Next by thread: Re: Question about placement of cuts
- Index(es):