0
我学习Prolog的,并具有以下给出行:什么值应该代替“下划线”?
Consider the following Prolog program. It contains facts regarding instructors of classes and
in which classes students are enrolled. instructor(p,c) means that professor p is the instructor
of course c. enrolled(s, c) means that student s is enrolled in course c. We want to use these
facts to answer queries concerning the professors who teach particular students.
instructor(fibonacci, math100).
instructor(turing, cs330).
instructor(galileo, phys210).
enrolled(john, math100).
enrolled(sofia, cs330).
enrolled(ryan, phys210).
enrolled(lisa, math100).
enrolled(matt, cs330).
enrolled(lisa, cs330).
然后还有一个问题:
What would Prolog return given the following queries? If a query has more than one answer, list all the answers.
?- instructor(galileo, _).
?- instructor(_, ee100).
我已经完成了所有的其他问题,但在遇到问题时与理解'_'
。 Prolog会产生什么答案?对于?- instructor(galileo, _).
我的假设是phys210
但第二个呢?