Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %P9: Pack consecutive duplicates of list elements into sublists.
- pack([],[]).
- pack([H,H|T], R) :- append([H], T, L), pack(L, [X|Y]),
- append([H], X, P), append([P], Y, R).
- pack([H|T], [[H]|R]):- pack(T, R).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement