2006/9/27, Yuvaraj Athur Raghuvir <[EMAIL PROTECTED]>:
[snip]
  NB. create a n by n matrix with 0 to (n-1) repeated n times
  n =. 3
  NB. solution1: ravel the laminations n-1 times
  (,: i.n) ,^: (<:n) (,: i.n)
0 1 2
0 1 2
0 1 2
  NB. hmmm... looks like the n can be factored out...
  NB. I see a reflex form, and then a power....
  NB. so,
  sol1 =: (,^: (<:])~) @: (,: i.)
  $ sol1 n
2 3 4 3
[snip]

There are a few problems here.  First, (,: i.) isn't what you mean
here. To pass y as the right argument of power and at the same time
use reflex, you need to use explicit definition, or deduce y from [:
,: i. y.

  sol1=:,^:(<:@#"[EMAIL PROTECTED])~@:([: ,: i.)
  sol1 3
0 1 2
0 1 2
0 1 2
  sol2=:13 : ',^:(<: y)~@:([: ,: i.) y'
  sol2 3
0 1 2
0 1 2
0 1 2

Actually, I prefer # ,:@i.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to