% Example 1 perm([], []). perm([H|T], List) :- take(List, H, L), perm(T, R). % Example 2 perm([], []). perm(List, [H|T]) :- take(List, H, L), perm(T, R). % Example 3 perm([], []). perm(List, [H|T]) :- take(List, H, L), perm(R, T).
Note: take/3 is defined by the following:
take([H|T], H, T). take([H|T], A, [H|U]) :- take(T, A, U).
Thanks a lot for your time!
This post has been edited by cosmicappuccino: 25 December 2011 - 11:49 AM

New Topic/Question
Reply




MultiQuote




|