I think we are being thrown by a possible misprint.
If the first term returned is really a[0]*b[0]+a[1]*b[2], this is just
2x2 matrix multiplication on ravelled arrays. Then compose(a,b) would
be
,(2 2 $ a) mp (2 2 $ b)
where
mp=:+/ .*
If you were really doing it in J, you would pass and return matrices, so
compose=:mp
which would have the advantage of working for nxn matrices.
If the term is really as written, I would write it as
(4 {. -(1{a)*(2{b))+,(2 2 $ a) mp (2 2 $ b)
to emphasize the matrix multiplication. I have no idea what how this
would generalize. Perhaps Terrence can supply a context.
Best wishes,
John
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm