I'm writing some code that recursively traverses through an open list.
Once I reach the end of the list, I'm having trouble distinguishing
between the following two cases:
Say the rule is foo(P). If I traverse through the list [a, b, c|_], in
my code, at the end it could be either P = _ or P = [c|_]. What I need
to do is write two foo() rules that capture the two different cases
(without changing the contents of P).
I tried is_list() but it doesn't work with open lists. Using length()
removes the open variable at the end.