f=, 13 : 0 '((i. 0);,.x),.(y);x +/ y'
try:
f=:
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Björn Helgason
Sent: Sunday, November 20, 2011 10:40 AM
To: Programming forum
Subject: Re: [Jprogramming] table challenge in simple J
Here it works to create tacit with 13 by using three lines
f=. 13 : 0
('';,.x),.(y);x +/ y
)
f
('' ; [: ,. [) ,. ] ; +/
a f b
┌─┬───────┐
│ │0 1 2 3│
├─┼───────┤
│2│2 3 4 5│
│3│3 4 5 6│
│5│5 6 7 8│
└─┴───────┘
I I now to to create it on one line it does not work this
f=, 13 : 0 '((i. 0);,.x),.(y);x +/ y'
)
|domain error
| f=, 13 :0'((i. 0);,.x),.(y);x +/ y'
If I do it like this the same thing
f
('' ; [: ,. [) ,. ] ; +/
f=.((i. 0) ; [: ,. [) ,. ] ; +/
It now works
f
((i.0) ; [: ,. [) ,. ] ; +/
a f b
┌─┬───────┐
│ │0 1 2 3│
├─┼───────┤
│2│2 3 4 5│
│3│3 4 5 6│
│5│5 6 7 8│
└─┴───────┘
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm