Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if and else and cut

Status
Not open for further replies.

kuntilanak

IS-IT--Management
Oct 29, 2008
2
US
Say that I have one predicate called test, and I have another predicate called checker, basically here's what I am trying to do in Prolog:

test :- checker(T), if checker suceeds(i.e, returns yes)
then print bla..bla..bla otherwise
checker processes the remaining predicates here ........
(which is still inside of test)

how can I represent all that in prolog in one single rule of test? is such thing possible?
 
Code:
% SWI-Prolog syntax
test :-
  (checker(T) -> <action when success> ; <action when fail>).
If there is no action when fails :
Code:
% SWI-Prolog syntax
test :-
  (checker(T) -> <action when success> ; true).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top