Translation to DCG Semicontext not working
问题 Since this question uses list, I wanted to solve it using DCG. In the process I realized that semicontext could be used. (DCG Primer) The original problem is to return count of items in a list but if two identical items are next to each other then don't increment the count. While my code works for some of the test cases, it fails for others. It is just one clause that is failing. In looking at the code with a debugger it appears that the second state variable, the returned list, is bound upon