[Jprogramming] ambivalent tacit verb with Self-Reference

'robert therriault' via Programming programming at jsoftware.com
Fri May 3 17:02:57 UTC 2019


Adding to Raul's solution, it can be simplified a little by removing the excess ]'s

    pad =: (1&$:) : ((0,.~0,.0,~0,]) ^:[ )
   pad i. 3 4
0 0 0  0  0 0
0 0 1  2  3 0
0 4 5  6  7 0
0 8 9 10 11 0
0 0 0  0  0 0

> On May 3, 2019, at 9:37 AM, Raul Miller <rauldmiller at gmail.com> wrote:
> 
>   pad =: (1&$:@]) :  ((0,.~0,.0,~0,]) ^:[ ])
> 
> Thanks,
> 
> -- 
> Raul
> 
> On Fri, May 3, 2019 at 12:35 PM Brian Schott <schott.brian at gmail.com> wrote:
>> 
>> 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 http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list