Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please note the grade you recieve when you evaluate is a provisional grade and may change. Write a Prolog program with a predicates pal/3, pal/4,

Please note the grade you recieve when you evaluate is a provisional grade and may change. Write a Prolog program with a predicates pal/3, pal/4, and pal/5, which test words with 3,4, and 5 letters respectively to see if they are palindromes. The program should respond to the following queries as indicated:

pal(b,o,b). true. pal(b,o,o). false. pal(n,o,o,n). true. pal(s,o,o,n). false. pal(n,a,v,a,n). true. pal(c,l,a,r,e). false. 

IMPORTANT: your program does not have to respond to queries where any of the letters are unknown (e.g. pal(X,o,b)). Your program does have to deal with all palindromes of length 3,4,5 though, so don't hardcode them. You will get very few marks for a program that only deals with the above queries. Hints:

a 3 letter palindrome is any word where the first and third letters are the same. How might you express this in Prolog? It's just one line.

if you are writing the predicates correctly, you might encounter a singleton error. Remember to use an underscore (_) for variables you don't really care about.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

4. Design a career management system.

Answered: 1 week ago

Question

4. Evaluation is ongoing and used to improve the system.

Answered: 1 week ago

Question

6. Effectively perform the managers role in career management.

Answered: 1 week ago