I'm trying to calculate the depth of the left branch in binary trees but the predicate keeps failing!
I've tried trace. and I've arrived to the conclusion that the fail status must come from the is\2 functor, but I still can't figure out what the problem is...
leftdepth(void,0).
leftdepth(tree(_,Left,_),N):-leftdepth(Left,N),N is N+1.
I expect the output of the query leftdepth(tree(3,tree(2,tree(5,void,void),tree(7,void,void)),void),3). to be true, but it outputs false.