Advertisement
SorinaD

Untitled

May 11th, 2021
589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.23 KB | None | 0 0
  1. elim([E | Rest], E, Rest).
  2. elim([X | Lst], E, [X | Rest]) :- elim(Lst, E, Rest).
  3.  
  4. perm([], []).
  5. perm([H | Lst], Perm) :- perm(Lst, NPerm), elim(Perm, H, NPerm).
  6.  
  7. sortList([], []).
  8. sortList(Lst, S) :- perm(Lst, S), isSorted(S).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement