Selasa, 08 Desember 2009

Looping Exercise Page 97

(1) Define a predicate to output the values of the squares of the integers from N1 to N2 inclusive and test it with N1 = 6 and N2 = 12.

pertama kita buat perintah seperti di bwah ini di notepad, kemudian disimpan dengan tipe .pl












kemudian kita mengetikkan perintah outsquare(6,12). Lalu tekan enter








(2) Define and test a predicate to read in a series of characters input by the user and
output all of those before the first new line or ? character.
pertama-tama buat rule seperti notepade berikut. Kemudian save dengan tipe .pl








Kemudian dari swi prolog consult rule tadi. Lalu kita masukkan perintah go.









(3) Using the person clauses given in Section 6.3.1, find the professions of all
those over 40.
pertama-tama buat rule seperti berikut, dan simpan dengan tipe .pl

lalu dari swi prolog kita consult file tadi. kemudian kita ketikkan perintah find.

Tidak ada komentar:

Posting Komentar