To be an array processing language, I am surprised to find the Pike code more
readable for this particular problem. Please spruce up my J code.


compose =: 4 : 0
a =. ((0 { x) * (0 { y))
b =. ((0 { x) * (1 { y)) + ((1 { x) * (3 { y)) 
c =. ((2 { x) * (0 { y)) + ((3 { x) * (2 { y)) 
d =. ((2 { x) * (1 { y)) + ((3 { x) * (3 { y))
a,b,c,d
)


-- Pike code follows --

array(int) compose(array(int) a, array(int) b)
{
  return ({ a[0]*b[0], a[0]*b[1]+a[1]*b[3],
            a[2]*b[0]+a[3]*b[2], a[2]*b[1]+a[3]*b[3] });
}


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to