Just remember, it's not in-place if you use the gerund form.

Henry Rich

Oleg Kobchenko wrote:
> Combining the two
> 
>    a=. i. 4 4
> 
>    1 2 ({:@[{])`([:<a:;{...@[)`] } a
>  0  8  2  3
>  4  9  6  7
>  8 10 10 11
> 12 11 14 15
> 
>> From: Henry Rich <[email protected]>
>>
>> If the array is large it is perhaps best to do it in-place:
>>
>>     a =. i. 4 4
>>     a =. (2 { a) (<a:;1)} a
>>     a
>>   0  8  2  3
>>   4  9  6  7
>>   8 10 10 11
>>  12 11 14 15
>>
> 
>> From: R.E. Boss <[email protected]>
>>
>> Column 1 replaced by row 2:
>>
>>
>>     1 2 (];(({:@[{|:@])`({...@[)`])}&.|:) i.4 4
>> +-----------+-----------+
>> | 0  1  2  3| 0  8  2  3|
>> | 4  5  6  7| 4  9  6  7|
>> | 8  9 10 11| 8 10 10 11|
>> |12 13 14 15|12 11 14 15|
>> +-----------+-----------+
> 
>> adam dunne wrote:
>>> Given a square table a=.i.4 4 is it possible, in one line, to replace
>>>
>>> Column 1 with row 2, using a gerund or directly. I seem to get rank errors.
> 
> 
>       
> ----------------------------------------------------------------------
> 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