Программирование на языке Пролог для искусственного интеллекта

6ec30db9

изменения для устранения лишних



Упражнения

10. 1. Определите отношение
        внутри( Эдем, Дер)
для поиска элемента Элем в 2-3 справочнике Дер.
Посмотреть ответ
10. 2.    Введите в программу Рисунок 10. 6 изменения для устранения лишних возвратов (определите отношения встав2 и соединить).
line(); %  Отображение 2-3 справочников
        отобр(Д) :-                                                                                                         15
            отобр( Д, 0).                                                                                             --
        отобр( nil, _ ).                                                                                            15
        отобр( л(А), Н) :-                                                                                        --
                tab( H), write( A), nl.                                                                               13


        отобр( в2( Д1, М, Д2), Н) :-                                                                  --
                H1 is H + 5                                                                                       13
                отобр( Д2, H1),                                                                               --
                tab( H), write( --), nl,                                                                               12
                tab( H), write( M), nl,                                                                           --
                tab( H), write( --), nl,                                                                         12
                отобр( Д1, H1).                                                                                         10
        отобр( в3( Д1, M2, Д2, М3, Д3), H) :-                                                        10
                H1 is H + 5                                                                                             --
                отобр( Д3, H1),                                                                                          8
                tab( H), write( --), nl,                                                      --
                tab( H), write( M3), nl,                                                    8
                отобр( Д2, H1),                                                                --
                tab( H), write( M2), nl,                                                                               7
                tab( H), write( --), nl,                                                                           --
                отобр( Д1, H1).                                                                                      7
                                                                                                                                 --
                           (a)                                                                                                      5
                                                                                                                           --                                                                                                                              5
                                                                                                                           --
                                                                                                                                       4
                                                                                                                                 --
                                                                                                                                 4
                                                                                                                                       3
                                                                                                                                 3
                                                                                                                                 --
                                                                                                                                        1
                                                                                                      (б)
line();



Содержание раздела