TURBO PROLOG. Терёхин В.В. - 62 стр.

UptoLike

Составители: 

62
"Kiss of the Spider Woman")). owns("Beth",
book("Frank Herbert", "Dune")).
owns("Beth",
book("Tom Clancy",
"The Hunt for Red October")).
owns("Linda", book("Garrison Keillor",
"Lake Wobegon Days")).
/* грампластинки */
owns("Bill", record("Elton John",
"Ice Fair", "popular")).
owns("Bill",
record("Michael Jackson - Lionel Richie",
"We are the World",
"popular")).
owns("Jack",
record("Bruce Springsteen",
"Born to Run", "popular")).
owns("Jack",
record("Benny Goodman",
"The King of Swing", "jazz")).
owns("Beth",
record("Madonna", "Madonna", "popular")).
/***** конец программы *****/
_____________________________________________________________
Приведенный ниже фрагмент показывает, как выглядела бы программа,
если бы Турбо-Пролог не поддерживал конструкций альтернативных описа-
ний доменов.
domains
person,whatever,author,title = symbol
artist,album,type = symbol
misc_thing = misc_thing(whatever)
book_library = book(author,title)
record_library = record(artist,album,type)
predicates
personal_thing(person,misc_thing)
personal_books(person,book_library)
personal_records(person,record_library)
clauses
personal_thing("Bill",misc_thing("sail boat")).
personal_books("Bill",book("J.R.R. Tolkein",
"Return of the Ring")).
          "Kiss of the Spider Woman")). owns("Beth",
          book("Frank Herbert", "Dune")).
     owns("Beth",
          book("Tom Clancy",
          "The Hunt for Red October")).
     owns("Linda", book("Garrison Keillor",
          "Lake Wobegon Days")).
          /* грампластинки */
     owns("Bill", record("Elton John",
          "Ice Fair", "popular")).
     owns("Bill",
          record("Michael Jackson - Lionel Richie",
          "We are the World",
          "popular")).
     owns("Jack",
          record("Bruce Springsteen",
          "Born to Run", "popular")).
     owns("Jack",
          record("Benny Goodman",
          "The King of Swing", "jazz")).
     owns("Beth",
          record("Madonna", "Madonna", "popular")).

/*****            конец программы            *****/
_____________________________________________________________

       Приведенный ниже фрагмент показывает, как выглядела бы программа,
если бы Турбо-Пролог не поддерживал конструкций альтернативных описа-
ний доменов.
       domains
person,whatever,author,title = symbol
artist,album,type            = symbol
misc_thing      = misc_thing(whatever)
book_library = book(author,title)
record_library = record(artist,album,type)

     predicates
personal_thing(person,misc_thing)
personal_books(person,book_library)
personal_records(person,record_library)

     clauses
personal_thing("Bill",misc_thing("sail boat")).
personal_books("Bill",book("J.R.R. Tolkein",
     "Return of the Ring")).


                                                                      62