Thanks Raul, I got to that section of phrases but didn't scroll down far
enough.

 

I like the fork in the tree better.

   

m7=:(<0 1)&|:

   f=: 13 :'(<0 1) |:y'

   5!:4 <'m7'

      -- <0 1
-- & -+- |:  

   5!:4 <'f'

  -- <0 1
--+- |:  
  L- ]   

   

   m7

(<0 1)&|:

   f

(<0 1) |: ]

   (m7 i.5 5)-:f i.5 5

1

   

Linda   

 

-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul Miller
Sent: Thursday, December 10, 2015 10:05 AM
To: Programming forum
Subject: Re: [Jprogramming] advent of code - day 2

 

On Thu, Dec 10, 2015 at 3:13 AM, Linda A Alvord <
<mailto:lindaalv...@verizon.net> lindaalv...@verizon.net> wrote:

> (I couldn't remember a shortcut to get a diagonal from a square matrix.

 

m7, m8, m9 and m10 from

 <http://www.jsoftware.com/help/phrases/special_matrices.htm>
http://www.jsoftware.com/help/phrases/special_matrices.htm get the main
diagonal (leading from the upper left corner to the lower right of the
table). But m9 only works on square tables (where the end of that diagonal
is also the lower right corner).

 

You can also get all of the diagonals that cross the main one using monadic
(u/.)

 

Does any of this help?

 

Thanks,

 

--

Raul

----------------------------------------------------------------------

For information about J forums see  <http://www.jsoftware.com/forums.htm>
http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to