sử dụng một chức năng thời gian chạy để poke xung quanh trong các cấu trúc lớp khác nhau tìm kiếm mã để gọi. Kỹ thuật này có thể được nhiều lần chậm hơn so với lộ trình C + +. Mục tiêu-C cho biết thêm tính linh hoạt và tiện lợi với chi phí | 14 Chapter 1. Facts Rules and Queries This tells Prolog to consult the file and load the contents as its new knowledge base. Assuming that the contains no typos Prolog will read it in maybe print out a message saying that it is consulting the file and then answer yes Incidentally it is quite common to store Prolog code in files with a .pl suffix. It s a useful indication of what the file contains namely Prolog code and with many Prolog implementations you don t actually have to type in the .pl suffix when you consult a file. Ok so Prolog should now know about all the KB2 predicates. And we can check whether it does by using the listing command again - listing. If you do this Prolog will list something like the following on the screen listensToMusic mia . happy yolanda . playsAirGuitar mia - listensToMusic mia . playsAirGuitar yolanda - listensToMusic yolanda . listensToMusic yolanda - happy yolanda . yes That is it will list the facts and rules that make up KB2 and then say yes. Once again you may get a little more than this such as the locations of various libraries that have been loaded. Incidentally listing can be used in other ways. For example typing - listing playsAirGuitar . simply lists all the information in the knowledge base about the playsAirGuitar predicate. So in this case Prolog will display playsAirGuitar mia - listensToMusic mia . playsAirGuitar yolanda - listensToMusic yolanda . yes . Practical Session 1 15 Well now you re ready to go. KB2 is loaded and Prolog is running so you can and should start making exactly the sort of inquiries we discussed in the text. But let s back up a little and summarize a few of the practical skills you will need to master to get this far You will need to know some basic facts about the operating system you are using such as the directory structure it uses. After all you will need to know how to save the files containing programs where you want them. You will need to know how to use some sort