A little late, but here's mine: v=: (<:3 3#:1 3 5 7)&(|.!.'x')
Louis > On 09 Jan 2017, at 15:58, Henry Rich <[email protected]> wrote: > > Better on big arrays: > > (2 _2 {."0/ _1 1) |.!.'x'"1 _ a > > This produces shape 2 2 3 4 which you could convert to shape 4 3 4 using (,/) > > Henry Rich > > >> On 1/9/2017 9:07 AM, Skip Cave wrote: >> Thanks, Henry! Yes, I meant a shape of 4 3 4. >> >> Skip Cave >> Cave Consulting LLC >> >>> On Sun, Jan 8, 2017 at 12:28 PM, Henry Rich <[email protected]> wrote: >>> >>> _1 1 (|.!.'x'"1"0 _ , |.!.'x'"0 _) a >>> >>> result has shape 4 3 4. >>> >>> Henry Rich >>> >>> >>>> On 1/8/2017 12:59 PM, Skip Cave wrote: >>>> >>>> I have a 3x4 array a: >>>> >>>> a >>>> >>>> abcd >>>> >>>> efgh >>>> >>>> ijkl >>>> >>>> >>>> I want a verb to create an array b that shifts a in 4 directions, and >>>> fills >>>> with 'x', creating a 2x3x4 array >>>> >>>> >>>> f a >>>> >>>> xabc >>>> >>>> xefg >>>> >>>> xijk >>>> >>>> >>>> bcdx >>>> >>>> fghx >>>> >>>> jklx >>>> >>>> >>>> xxxx >>>> >>>> abcd >>>> >>>> efgh >>>> >>>> >>>> efgh >>>> >>>> ijkl >>>> >>>> xxxx >>>> >>>> What is the most efficient J way to do this? The order of the 4 shifts are >>>> not important. >>>> >>>> Skip >>>> ---------------------------------------------------------------------- >>>> For information about J forums see http://www.jsoftware.com/forums.htm >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
