My query would be the following:
separate([eat(chips),drink(water),eat(burger),eat(banana),drink(coke)],food,drink).
food = [eat(chips),eat(burger),eat(banana)]
drink = [drink(water),drink(coke)]
I want to separate the list but I've not been able to figure out how to.
separate(X,Cat1,Cat2):-
[Cat1|Cat2] = X,
Cat2 = X,
separate(X,Cat1,Cat2).
Currently I've been only able to use recursion to go through each element of the list but I don't really have any idea on how to start separating them into separate lists.