I forgot, the latter form can also be written as,

   op=. (<^:(0 = L.)@:)("0)/


On Sat, Apr 2, 2016 at 9:39 AM, Jose Mario Quintana <
[email protected]> wrote:

>    (A=. i.3) ; (B=. i.4)
> ┌─────┬───────┐
> │0 1 2│0 1 2 3│
> └─────┴───────┘
>
> One might want to have the results boxed:
>
>    op=. (<@:)("0)/
>
>    A ,op B
> ┌───┬───┬───┬───┐
> │0 0│0 1│0 2│0 3│
> ├───┼───┼───┼───┤
> │1 0│1 1│1 2│1 3│
> ├───┼───┼───┼───┤
> │2 0│2 1│2 2│2 3│
> └───┴───┴───┴───┘
>    A %op B
> ┌─┬─┬───┬────────┐
> │0│0│0  │0       │
> ├─┼─┼───┼────────┤
> │_│1│0.5│0.333333│
> ├─┼─┼───┼────────┤
> │_│2│1  │0.666667│
> └─┴─┴───┴────────┘
>
> One might not:
>
>    op=. ("0)/
>
>    A ,op B
> 0 0
> 0 1
> 0 2
> 0 3
>
> 1 0
> 1 1
> 1 2
> 1 3
>
> 2 0
> 2 1
> 2 2
> 2 3
>
>    A %op B
> 0 0   0        0
> _ 1 0.5 0.333333
> _ 2   1 0.666667
>
> One might want to have them both ways:
>
>    op=. (<`]@.('' -: $)@:)("0)/
>
>    A ,op B
> ┌───┬───┬───┬───┐
> │0 0│0 1│0 2│0 3│
> ├───┼───┼───┼───┤
> │1 0│1 1│1 2│1 3│
> ├───┼───┼───┼───┤
> │2 0│2 1│2 2│2 3│
> └───┴───┴───┴───┘
>    A %op B
> 0 0   0        0
> _ 1 0.5 0.333333
> _ 2   1 0.666667
>
>
>
> On Sat, Apr 2, 2016 at 3:11 AM, Gian Medri <[email protected]> wrote:
>
>> Hi !
>>
>> In J the outer product  has the form:    a foo/ b.
>> It doesn't  work for comma.
>> Example
>> a=: i. 3
>> b=: i.4
>> [  a ,/ b
>> 0 1 2 0 1 2 3
>> APL
>>  a °. , b
>>  0 0  0 1  0 2  0 3
>>  1 0  1 1  1 2  1 3
>>  2 0  2 1  2 2  2 3
>>
>> 3 x 4 boxed result
>>
>> Can I have the same result  in J as easily as in APL?
>> Best regards
>> ----------------------------------------------------------------------
>> 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