Messy but possible.

pad5=: 13 :'(((x#0) ,"2 ((x#0) ,"2~ 0 (,"2) 0 ,"1~ (x#0) ,"1 ])) y)(,"2) (x#0)'
      
   3 pad5 i.3 4
0 0 0 0 0  0  0 0
0 0 0 0 0  0  0 0
0 0 0 0 1  2  3 0
0 0 0 4 5  6  7 0
0 0 0 8 9 10 11 0
0 0 0 0 0  0  0 0
0 0 0 0 0  0  0 0
   
   pad5
4 : '(((x#0) ,"2 ((x#0) ,"2~ 0 (,"2) 0 ,"1~ (x#0) ,"1 ])) y)(,"2) (x#0)'
   
Linda

-----Original Message-----
From: Programming <[email protected]> On Behalf Of Brian 
Schott
Sent: Friday, May 3, 2019 12:36 PM
To: Programming forum <[email protected]>
Subject: [Jprogramming] ambivalent tacit verb with Self-Reference

How do I create the verb `pad` below so that the first and the last expressions 
below produce the same result?

   pad =: (1&$:@]) :  (0,.~0,.0,~0,]) ^:[ ]
   $ 1 pad i. 3 4
5 6
   $ 2 pad i. 3 4
7 8
   $ pad i. 3 4
3 4 25 26


--
(B=)
----------------------------------------------------------------------
For information about J forums see 
https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7Cdbbe47bf57bf44e560e808d6cfe567bf%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636924981523618471&amp;sdata=Uh1uOt3ff9Fsvw9%2Fb%2B11Jp1lgd2%2B4OG9K%2Fw9OjF2mPo%3D&amp;reserved=0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to