Re: [考題] 程式語言考古題
考慮下述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
→
06/27 12:12, , 1F
06/27 12:12, 1F
→
06/27 12:13, , 2F
06/27 12:13, 2F
推
06/27 23:45, , 3F
06/27 23:45, 3F
討論串 (同標題文章)