Have you been a teacher? Great exposition!
On 11/20/2011 7:53 AM, Björn Helgason wrote:
> f=. 13 : 0
> ('';,.x),.(y);x +/ y
> )
> f
> ('' ; [: ,. [) ,. ] ; +/
>
>
> 2011/11/20 Kip Murray<[email protected]>
>
>> Now make this into a tacit verb table so that a table b gives you the
>> table.
>>
>> On 11/20/2011 7:09 AM, Björn Helgason wrote:
>>> or
>>>
>>> ('';,.a),.(b);a +/ b
>>>
>>> 2011/11/20 Björn Helgason<[email protected]>
>>>
>>>>
>>>> Ok it is simple j we are after
>>>> We start by defining a and b
>>>>
>>>> a=: 2 3 5
>>>> b=: 0 1 2 3
>>>>
>>>> Then we create the elements we want
>>>>
>>>> '';b;a;a +/ b
>>>> ┌┬───────┬─────┬───────┐
>>>> ││0 1 2 3│2 3 5│2 3 4 5│
>>>> ││ │ │3 4 5 6│
>>>> ││ │ │5 6 7 8│
>>>> └┴───────┴─────┴───────┘
>>>>
>>>> Now we rearrange a so it goes down in a column
>>>>
>>>> '';b;(,.a);a +/ b
>>>> ┌┬───────┬─┬───────┐
>>>> ││0 1 2 3│2│2 3 4 5│
>>>> ││ │3│3 4 5 6│
>>>> ││ │5│5 6 7 8│
>>>> └┴───────┴─┴───────┘
>>>>
>>>> Next we arrange it in a 2 by 2
>>>>
>>>> ('';b),.(,.a);a +/ b
>>>> ┌───────┬───────┐
>>>> │ │2 │
>>>> │ │3 │
>>>> │ │5 │
>>>> ├───────┼───────┤
>>>> │0 1 2 3│2 3 4 5│
>>>> │ │3 4 5 6│
>>>> │ │5 6 7 8│
>>>> └───────┴───────┘
>>>>
>>>> ooppss wrong wa around we fix it with transpose
>>>>
>>>>
>>>> |:('';b),.(,.a);a +/ b
>>>> ┌─┬───────┐
>>>> │ │0 1 2 3│
>>>> ├─┼───────┤
>>>> │2│2 3 4 5│
>>>> │3│3 4 5 6│
>>>> │5│5 6 7 8│
>>>> └─┴───────┘
>>>>
>>>>
>>>
>>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm