程式語言考古題 - 考試

Table of Contents



考慮下述Prolog程式:
ancestor(x,x).
ancestor(x,y) :- ancestor(z,y), parent(x,z).
parent(Allen, John).
用一個subgoal的搜尋樹(search tree),描述此Prolog程式在執行查詢:
ancestor(Allen,X)時的執行步驟。



可以請問大家 為什麼右邊是stop嗎 ?

上完課還是有點聽不懂


ancestor(Allen,X)
/ \
/ \
1 / \ 2
/ \
/ \
ancestor(Allen,Allen) Stop
{ X = Allen }
success


--

All Comments

Tom avatarTom2015-06-27
認真跟你說..老師教錯了@@
Ophelia avatarOphelia2015-06-30
假設題目真的是這樣考 沒出錯題目的話..
Ursula avatarUrsula2015-06-30
能說一下是哪個老師教的嗎....