Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. groesser([], [], 0).
  2. groesser([A|As], [B|Bs], X) :- greater_than_list([A], [B|Bs], 0, X), X is X + 1, write(X), nl, groesser(As, B, X).
  3. groesser([A|As], [B|Bs], X) :- ignore(greater_than_list([A], [B|Bs], 0, X)), write(X), nl, groesser(As, B, X).
  4.  
  5. greater_than_list(A, [B|Bs], Y, _) :- A>B, Y is Y + 1, greater_than_list(A, Bs, Y, _).
  6. greater_than_list(_, [], Y, X) :- Y>0, X is X + 1.
  7.  
  8.  
  9.  
  10.  
  11. % groesser([], [], 0).
  12. % groesser([A|As], [B|Bs], X) :- greater_than_list([A], [B|Bs]), X is X + 1, write(X), nl, groesser(As, B, X).
  13. % groesser([A|As], [B|Bs], X) :- greater_than_list([A], [B|Bs]), write(X), nl, groesser(As, B, X).
  14.  
  15. % greater_than_list(A, [B|Bs]) :- A>B, greater_than_list(A, Bs).
  16. % greater_than_list(_, []).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement