Solved

prolog if and else using cut

Posted on 2008-10-28
8
645 Views
Last Modified: 2008-10-29
Okay, 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 ........

how can I represent all that in prolog in one single rule of test?
0
Comment
Question by:kuntilanak
  • 5
  • 3
8 Comments
 
LVL 27

Accepted Solution

by:
ddrudik earned 500 total points
ID: 22831335
kuntilanak, regular expressions might not be what you understand them:
http://en.wikipedia.org/wiki/Regular_expression

They are not related to prolog logic etc.

If you cannot find a prolog forum here at EE, you might try:
http://www.nabble.com/Gnu---Prolog-f1818.html
http://www.tek-tips.com/threadminder.cfm?pid=345
0
 

Author Comment

by:kuntilanak
ID: 22831408
thanks that really helps as I never were to get any answers regarding prolog here.. if you have any other suggestions of prolog forums, I would really appreciated it
0
 
LVL 27

Expert Comment

by:ddrudik
ID: 22831448
The two forum links in my first post are the ones I found, but you could just search the web for "prolog forum" and browse, that's all I did.
0
 

Author Comment

by:kuntilanak
ID: 22831458
I tried that but never found some really good ones
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 27

Expert Comment

by:ddrudik
ID: 22831479
There might not be any, your questions are the first I have heard of prolog.  If this is related to homework possibly ask other students in your class or a TA etc. about prolog resources they might be aware of.
0
 

Author Comment

by:kuntilanak
ID: 22832044
it's not about homework. it's about a concept.. I was just asking whether it's possible or not
0
 
LVL 27

Expert Comment

by:ddrudik
ID: 22832239
No worries, not sure about other resources then outside of the forum links I provided.
0
 
LVL 27

Expert Comment

by:ddrudik
ID: 22836980
Thanks for the question and the points.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now