作者RedJessy (Jessy)
看板Examination
標題Re: [考題] 程式語言考古題
時間Sat Jun 27 11:24:57 2015
考慮下述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
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 198.50.150.59
※ 文章網址: https://www.ptt.cc/bbs/Examination/M.1435375500.A.97E.html
→ emstarbucks: 認真跟你說..老師教錯了@@ 06/27 12:12
→ emstarbucks: 假設題目真的是這樣考 沒出錯題目的話.. 06/27 12:13
推 APE36: 能說一下是哪個老師教的嗎.... 06/27 23:45