Hello Terrence;

The choice of indices does not seem to follow a pattern I recognize. What is the context for this definition?



bill lam wrote:
I think that this is a little bit more readable,

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
)

Hope that this sort of expressions will not happen frequently.

Terrence Brannon wrote:
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




--
later ...
<pre>------------------------------------------------------------------------
|\/| Randy A MacDonald   | APL: If you can say it, it's done.. (ram)
|/\| [EMAIL PROTECTED]  |
|\ |                     | The only real problem with APL is that
BSc(Math) UNBF'83        | it is "still ahead of its time."
Sapere Aude              |     - Morten Kromberg
Natural Born APL'er      | Looking for a whip-smart APL developer <a href="mailto:[EMAIL 
PROTECTED]">Send me a note</a>
-----------------------------------------------------(INTP)----{ gnat }-</pre>

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

Reply via email to