Solved

prolog if and else using cut

Posted on 2008-10-28
8
636 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
A short article about problems I had with the new location API and permissions in Marshmallow
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

747 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

12 Experts available now in Live!

Get 1:1 Help Now