Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pack([],[]).
- pack([H], [[H]]).
- pack([H,H|T], R) :- append([H], T, L), pack(L, [X|Y]),
- append([H], X, P), append([P], Y, R).
- pack([H|T], R):- pack(T, L), append([H], L, R).
- ?- pack([1,1,2,2,1,1,1,3],R).
- R = [[1|1], [2|2], [1, 1|1], [3]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement