在prolog中insertBST - 为什么它返回false

时间:2016-05-19 19:08:21

标签: prolog

尽管我追踪了我的计划,但我无法理解为什么它会返回false

insertBST(t(Root, L, R), Root, t(Root, L, R)).
insertBST(nil, Elem, t(Elem, nil, nil)).
insertBST(t(Root, L, R), Elem, t(Root, L, newR)) :-
    Root < Elem,
    insertBST(R, Elem, newR).
insertBST(t(Root, L, R), Elem, node(Root, newL, R)) :-
    Root > Elem,
    insertBST(L, Elem, newL).

?- insertBST(t(11, nil, nil), 15, X).
false.

你能解释一下吗?

0 个答案:

没有答案
相关问题