Advertisement
Guest User

Untitled

a guest
Aug 30th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.32 KB | None | 0 0
  1. %%does work
  2.  
  3. accDot([],[],A,A).
  4.  
  5. accDot([H1|T1], [H2|T2], A, Result) :-
  6.   is(Anew,+(A,*(H1,H2))),
  7.   accDot(T1, T2, Anew, Result).
  8.  
  9. dot(Vector1, Vector2, Result) :-
  10.   accDot(Vector1, Vector2, 0, Result).
  11.  
  12.  
  13.  
  14. %% doesn't work
  15.  
  16.  dot([],[],A).
  17.  
  18. dot([H1|T1], [H2|T2], A) :-
  19.   is(Anew,+(A,*(H1,H2))),
  20.   dot(T1, T2, Anew).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement