Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
E-Bookshop-master / uploads / file / 0152_T_Sebesta_programming.pdf
Скачиваний:
265
Добавлен:
28.06.2021
Размер:
5.2 Mб
Скачать

Programming Exercises

761

5.Write the following English conditional statements as Prolog headed Horn clauses:

a.If Fred is the father of Mike, then Fred is an ancestor of Mike.

b.If Mike is the father of Joe and Mike is the father of Mary, then Mary is the sister of Joe.

c.If Mike is the brother of Fred and Fred is the father of Mary, then Mike is the uncle of Mary.

6.Explain two ways in which the list-processing capabilities of Scheme and Prolog are similar.

7.In what way are the list-processing capabilities of Scheme and Prolog different?

8.Write a comparison of Prolog with ML, including two similarities and two differences.

9.From a book on Prolog, learn and write a description of an occurcheck problem. Why does Prolog allow this problem to exist in its implementation?

10.Find a good source of information on Skolem normal form and write a brief but clear explanation of it.

P R O G R A M M I N G E X E R C I S E S

1.Using the structures parent(X, Y), male(X), and female(X), write a structure that defines mother(X, Y).

2.Using the structures parent(X, Y), male(X), and female(X), write a structure that defines sister(X, Y).

3.Write a Prolog program that finds the maximum of a list of numbers.

4.Write a Prolog program that succeeds if the intersection of two given list parameters is empty.

5.Write a Prolog program that returns a list containing the union of the elements of two given lists.

6.Write a Prolog program that returns the final element of a given list.

7.Write a Prolog program that implements quicksort.

This page intentionally left blank

Соседние файлы в папке file