I have a prolog assignment.
I need to look at the first item in a list, see if its following items are the same until they are not and separate the lists by the firs
When the first two elements are different you do not need a recursive goal.
grab([], [], []). grab([A,A|Rest], [A|As], L2):- !, grab([A|Rest], As, L2). grab([A|Tail], [A], Tail).