\ 4tH library - Dot Product - Copyright 2010 J.L. Bezemer
\ You can redistribute this file and/or modify it under
\ the terms of the GNU General Public License

[UNDEFINED] dotproduct [IF]
: dotproduct                           ( x1 x2 n1 -- n2)
  0 tuck ?do -rot over i th @ over i th @ * >r rot r> + loop nip nip
;
[THEN]

\ 3 constant /vector
\ /vector array a
\ /vector array b
\ : vector! bounds ?do i ! loop ;
\ -5  3 1 a /vector vector!
\ -1 -2 4 b /vector vector!
\ a b /vector dotproduct .

