0

Artificial intelligence with prolog

Write a prolog program that solves the following problems 1. Construct a rule palindrome which takes a word as a list or characters and checks to see whether it as a palindrome or not. (A palindrome is a word or phrase that is the same forwards as it is backwards e.g. radar). It should works as follows: ? - palindrome ( [ n, a, v, a, n ] ). Yes ? - palindrome ( [ d, u, b, l, i, n ] ). No 2. Write a predicate replace/4 to replace all occurrences of a given element (second argument) by another given element (third argument) in a given list (first argument). It should work as follows: ?- replace ([1, 2, 3, 4, 3, 5, 6, 3], 3, x, List). List = [1, 2, x, 4, x, 5, 6, x] Yes 3. Implement a Prolog predicate remove_duplicates/2 that removes all duplicate elements from a list given in the first argument and returns the result in the second argument position. It should work as follows: ?- remove_duplicates([a, b, a, c, d, d], List). List = [b, a, c, d] Yes

14th Nov 2020, 11:46 AM
Bâÿăň Ã Øťöŏm
Bâÿăň Ã Øťöŏm - avatar
4 Answers
0
Nasif Rahman yas، Can you help me ؟
14th Nov 2020, 12:16 PM
Bâÿăň Ã Øťöŏm
Bâÿăň Ã Øťöŏm - avatar
0
I do not know the complete answer
14th Nov 2020, 12:19 PM
Bâÿăň Ã Øťöŏm
Bâÿăň Ã Øťöŏm - avatar
0
Nasif Rahman Thank you I hope to get the answer 🥺
14th Nov 2020, 12:25 PM
Bâÿăň Ã Øťöŏm
Bâÿăň Ã Øťöŏm - avatar
0
19th Nov 2020, 4:31 PM
مجدي يوسف ابوهويدي
مجدي يوسف ابوهويدي - avatar