Solved

prolog if and else using cut

Posted on 2008-10-28
8
663 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kuntilanak
ID: 22831458
I tried that but never found some really good ones
0
 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A short article about a problem I had getting the GPS LocationListener working.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …

740 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