Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.31 KB | None | 0 0
  1. diff([],[], []).
  2. diff(_,[], []).
  3. diff([],_, []).
  4.  
  5. diff([A|TailA], [B|TailB], [Сomposition|СompositionTail]):-
  6.     Сomposition is A-B, diff(TailA, TailB, СompositionTail).
  7.  
  8. len([], 0).
  9. len([_|T], L) :- len(T, Y), L is Y + 1.
  10.  
  11. diff_len([], [], 0).
  12. diff_len(A, B, X) :- diff(A, B, Diff), len(Diff, X).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement