Here's a simple function:
f=:(0 ,.~ 0 ,. 0 ,~ 0 , ])^:[
3 f i.3 4
0 0 0 0 0 0 0 0 0 0
0 0 0 0 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 0 0 4 5 6 7 0 0 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 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
But, oddly, I can't define this function explicitly.
Linda
-----Original Message-----
From: Programming <[email protected]> On Behalf Of Linda
Alvord
Sent: Saturday, May 4, 2019 9:28 PM
To: [email protected]
Subject: Re: [Jprogramming] ambivalent tacit verb with Self-Reference
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://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C74bd3f3afa384a512a2e08d6d0f8dc9a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636926164598349863&sdata=D2cdLWKttLc7%2FRWfWlyB1acZ10rYw2eC00m%2FLWToRSQ%3D&reserved=0
----------------------------------------------------------------------
For information about J forums see
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C74bd3f3afa384a512a2e08d6d0f8dc9a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636926164598349863&sdata=D2cdLWKttLc7%2FRWfWlyB1acZ10rYw2eC00m%2FLWToRSQ%3D&reserved=0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm