a=: 10 20 30 40
b=: 3 6 9 12


NB.  Form a conjunction which selects elements
NB.  from x and y and finds their inner product
NB. then construct the verb. Like June Kim's NB. solution it permits a wide range of cases.

conj =: 2 : 0
:
(m{x) +/ . * n{y
)

conjv =: (0 conj 0),(0 1 conj 1 3),(2 3 conj 0 2),2 3 conj 1 3
a conjv b
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to