Useful and interesting ... but where would I find a discussion / explanation of 
"#inv" on the wiki?
NuVoc and other vocabulary lists tend to have primitives only.
In my experience so far, very useful non-primitive structures like "each" you 
have to discover by reading all available materials and monitoring these 
discussions. 
Is there is list of non-primitive standard structures somewhere I am missing?  
The only place I found #inv in a search on the wiki was in the APL to 
JPhrasebook, which I would not generally use since I don't speak APL.  I do 
however like to replace items in matrices.  Simple things like replace column 5 
with column 2 * column 3 etc ... which is really important since when trying to 
convert some Excel users into J users.

Kyle Rudden

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Raul Miller
Sent: Thursday, September 11, 2014 5:33 AM
To: Programming forum
Subject: Re: [Jprogramming] Extend/reduce matrix dimensions

Here are some perhaps relevant examples:

   1 1 0 1 #inv (3 3$ 0)
0 0 0
0 0 0
0 0 0
0 0 0
   1 1 0 1 #inv!.1 (3 3$ 0)
0 0 0
0 0 0
1 1 1
0 0 0
   1 1 0 1 #inv!.1"1 (3 3$ 0)
0 0 1 0
0 0 1 0
0 0 1 0
   1 1 0 1 #inv!.1"1 (1 1 0 1) #inv!.1 (3 3$ 0)
0 0 1 0
0 0 1 0
1 1 1 1
0 0 1 0
   1 1 0 1 # 1 1 0 1 #inv!.1"1 (1 1 0 1) #inv!.1 (3 3$ 0)
0 0 1 0
0 0 1 0
0 0 1 0
   1 1 0 1 #("1) 1 1 0 1 # 1 1 0 1 #inv!.1"1 (1 1 0 1) #inv!.1 (3 3$ 0)
0 0 0
0 0 0
0 0 0
   (i.3) 2} 1 1 0 1 #inv (3 3$0)
0 0 0
0 0 0
0 1 2
0 0 0
   (i.4) 2}"0 1 (1 1 0 1) #inv"1 (i.3) 2} 1 1 0 1 #inv (3 3$0)
0 0 0 0
0 0 1 0
0 1 2 2
0 0 3 0
   (i.4) 2}"0 1 (1 1 0 1) #inv"1 (0 1 3) 2} 1 1 0 1 #inv (3 3$0)
0 0 0 0
0 0 1 0
0 1 2 3
0 0 3 0

The whole #inv thing is a bit quirky but was quite deliberate. This was a 
primitive in APL, but the syntax was ... strange. Rather than trying to find a 
special symbol for this operation, Iverson put it on #inv (since - logically 
speaking - it's the inverse of #).

Thanks,

--
Raul


On Thu, Sep 11, 2014 at 5:21 AM, Sebastian <[email protected]> wrote:

> Hi,
>
> I know the verbs , ,. ,: to add rows, columns and dimensions to matrices.
> It is easy to add these to begin or the end of the corrosponding dimension,
> but what is to do, if I want to add one row/column in the middle of a
> matrix? Is the only way to slice the matrix in two pieces and join them
> with the new row/column?
>
> A few examples:
>
> Initial situation:
>
> 3 3 $ 0
> 0 0 0
>
> 0 0 0
>
> 0 0 0
>
>
> add column somewhere to the middle:
>
> 0 0 1 0
>
> 0 0 1 0
>
> 0 0 1 0
>
>
>
> add row somewhere to the middle:
>
> 0 0 1 0
>
> 0 0 1 0
>
> 1 1 1 1
>
> 0 0 1 0
>
>
> remove the added column:
>
> 0 0 0
>
> 0 0 0
>
> 1 1 1
>
> 0 0 0
>
>
>
> and the row:
>
>
>
> 0 0 0
>
> 0 0 0
>
> 0 0 0
>
>
>
> Can anyone help me with this?
>
>
>
> Regards
>
> Sebastian
> ----------------------------------------------------------------------
> 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

Reply via email to