There are a few examples of use of ranks at

http://groups.google.com/group/j-programming/browse_thread/thread/5f0bcf9bd5210adf#

2010/4/26 Björn Helgason <[email protected]>:
> When you are working with rank you can investigate it by using b.
>
>
>   # b. 0
> _ 1 _
>
> You can change the rank as you do
>   #"2 b. 0
> 2 2 2
>
> As you see you then get three numbers and the first is for the monadic
> case and then for left and right argument so the first number means
> nothing when you apply it dyadically.
>
> I am not sure why you want to use each when it is enough to use >
>
>   1 2 3 4 #"0 1 2 > <x
>  0  1  2  3  4  5
>  6  7  8  9 10 11
>  6  7  8  9 10 11
> 12 13 14 15 16 17
> 12 13 14 15 16 17
> 12 13 14 15 16 17
> 18 19 20 21 22 23
> 18 19 20 21 22 23
> 18 19 20 21 22 23
> 18 19 20 21 22 23
>
>
> 2010/4/26 Robert O'Boyle <[email protected]>:
>> Ah! Thanks. This explains it. Much appreciated
>>
>> Bob
>>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Henry Rich
>> Sent: April 26, 2010 8:52 AM
>> To: Programming forum
>> Subject: Re: [Jprogramming] Each and #
>>
>> You want the entire 1 2 3 4 to be the left operand, but &.> (each)
>> doesn't do that, because it is rank 0.  So it 'unboxes' (i. e. passes
>> through) the atoms of 1 2 3 4 individually, giving the result you see.
>>
>> Some ways that work:
>>
>> (<1 2 3 4) # each <x
>>
>> 1 2 3 4&# each <x
>>
>> 1 2 3 4 <@(#>)"_ 0 <x
>>
>> Henry Rich
>>
>> Robert O'Boyle wrote:
>>> Hi
>>>
>>>
>>>
>>> I have a matrix, x, which is boxed
>>>
>>>
>>>
>>>    x=. i. 4 6
>>>
>>>     <x
>>>
>>> ------------------┐
>>>
>>> │ 0  1  2  3  4  5│
>>>
>>> │ 6  7  8  9 10 11│
>>>
>>> │12 13 14 15 16 17│
>>>
>>> │18 19 20 21 22 23│
>>>
>>> L------------------
>>>
>>> I want to copy each row of x. Using #, I can do this on the unboxed x
>> matrix
>>>
>>>
>>>
>>>    1 2 3 4 #"2 x
>>>
>>>
>>>
>>>  0  1  2  3  4  5
>>>
>>>  6  7  8  9 10 11
>>>
>>>  6  7  8  9 10 11
>>>
>>> 12 13 14 15 16 17
>>>
>>> 12 13 14 15 16 17
>>>
>>> 12 13 14 15 16 17
>>>
>>> 18 19 20 21 22 23
>>>
>>> 18 19 20 21 22 23
>>>
>>> 18 19 20 21 22 23
>>>
>>> 18 19 20 21 22 23
>>>
>>>
>>>
>>> But I get an unexpected result when I use the verb 'each'.
>>>
>>>
>>>
>>> 1 2 3 4 #"2 each <x
>>>
>>> ------------------T-----------------T-----------------T-----------------┐
>>>
>>> │ 0  1  2  3  4  5│ 0  1  2  3  4  5│ 0  1  2  3  4  5│ 0  1  2  3  4  5│
>>>
>>> │ 6  7  8  9 10 11│ 0  1  2  3  4  5│ 0  1  2  3  4  5│ 0  1  2  3  4  5│
>>>
>>> │12 13 14 15 16 17│ 6  7  8  9 10 11│ 0  1  2  3  4  5│ 0  1  2  3  4  5│
>>>
>>> │18 19 20 21 22 23│ 6  7  8  9 10 11│ 6  7  8  9 10 11│ 0  1  2  3  4  5│
>>>
>>> │                 │12 13 14 15 16 17│ 6  7  8  9 10 11│ 6  7  8  9 10 11│
>>>
>>> │                 │12 13 14 15 16 17│ 6  7  8  9 10 11│ 6  7  8  9 10 11│
>>>
>>> │                 │18 19 20 21 22 23│12 13 14 15 16 17│ 6  7  8  9 10 11│
>>>
>>> │                 │18 19 20 21 22 23│12 13 14 15 16 17│ 6  7  8  9 10 11│
>>>
>>> │                 │                 │12 13 14 15 16 17│12 13 14 15 16 17│
>>>
>>> │                 │                 │18 19 20 21 22 23│12 13 14 15 16 17│
>>>
>>> │                 │                 │18 19 20 21 22 23│12 13 14 15 16 17│
>>>
>>> │                 │                 │18 19 20 21 22 23│12 13 14 15 16 17│
>>>
>>> │                 │                 │                 │18 19 20 21 22 23│
>>>
>>> │                 │                 │                 │18 19 20 21 22 23│
>>>
>>> │                 │                 │                 │18 19 20 21 22 23│
>>>
>>> │                 │                 │                 │18 19 20 21 22 23│
>>>
>>> L-----------------+-----------------+-----------------+------------------
>>>
>>>
>>>
>>> Any assistance on this would be appreciated.
>>>
>>>
>>>
>>> Bob
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ----------------------------------------------------------------------
>>> 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
>
>
>
> --
> Björn Helgason, Verkfræðingur
> Fornustekkum II
> 781 Hornafirði,
> t-póst: [email protected]
> gsm: +3546985532
> sími: +3544781286
> http://groups.google.com/group/J-Programming
>
>
> Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
>
> góður kennari getur stigið á tær án þess að glansinn fari af skónum
>          /|_      .-----------------------------------.
>         ,'  .\  /  | Með léttri lund verður        |
>     ,--'    _,'   | Dagurinn í dag                     |
>    /       /       | Enn betri en gærdagurinn  |
>   (   -.  |        `-----------------------------------'
>   |     ) |         (\_ _/)
>  (`-.  '--.)       (='.'=)   ♖♘♗♕♔♙
>   `. )----'        (")_(") ☃☠
>



-- 
Björn Helgason, Verkfræðingur
Fornustekkum II
781 Hornafirði,
t-póst: [email protected]
gsm: +3546985532
sími: +3544781286
http://groups.google.com/group/J-Programming


Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans

góður kennari getur stigið á tær án þess að glansinn fari af skónum
          /|_      .-----------------------------------.
         ,'  .\  /  | Með léttri lund verður        |
     ,--'    _,'   | Dagurinn í dag                     |
    /       /       | Enn betri en gærdagurinn  |
   (   -.  |        `-----------------------------------'
   |     ) |         (\_ _/)
  (`-.  '--.)       (='.'=)   ♖♘♗♕♔♙
   `. )----'        (")_(") ☃☠
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to