That seems to be the case.

On Wed, Dec 13, 2017 at 5:11 PM, Erling Hellenäs <[email protected]>
wrote:

> Stated differently, the i. in the manual page for i. is different from the
> i. you use in your programs and write at the terminal. The relation between
> them is
> i.(terminal) <=> i.(manual page)"1 /Erling
>
>
> On 2017-12-13 20:53, Erling Hellenäs wrote:
>
>> Yes, as far as I understand when you execute a monadic rank 1 verb you
>> also execute an implicit rank adverb. At least that is how JWithATwist
>> works.
>> i. y <=> i."1 y
>> Same with all other J functions with a rank less than _ or _ _. However,
>> I think the scalar functions have different helper programs. So, we have
>> four helper programs. The monadic and dyadic rank adverb and similar helper
>> programs for monadic and dyadic scalar functions.
>> Pretty important to understand all about, including strange cases when
>> the arguments are empty.
>> /Erling
>>
>> On 2017-12-13 19:18, Jose Mario Quintana wrote:
>>
>>> Apparently, TongKe Xue got an answer to his question (and even more);
>>> but,
>>> I have at least one of my own.
>>>
>>> The Dictionary is the official reference and the (vocabulary) entry for
>>> i.
>>> ( http://www.jsoftware.com/help/dictionary/didot.htm ). reads in part:
>>>
>>> "
>>> Integers i.  1
>>>
>>> The shape of i.y is |y , and its atoms are the first */|y non-negative
>>> integers.
>>> "
>>>
>>> However, for the case at hand,
>>>
>>>      Y=. 2 2 $ 1 2 3 4
>>>
>>>     $i.Y
>>> 2 3 4
>>>
>>>     |Y
>>> 1 2
>>> 3 4
>>>
>>> This suggests to me that either the implementation is wrong or the
>>> Dictionary is wrong (or at least too terse).  Which one is wrong?
>>>
>>> My guess is that the Dictionary claim about the shape and contents of the
>>> result is within the context of its rank (1).  Why?  Because for
>>> non-negative
>>> integers,
>>>
>>>     (i. -: (| $ i.@:(*/)@:|)("1))Y
>>> 1
>>>
>>> Let us try one more level up,
>>>
>>>     Y=. 2 2 3 $ i.12
>>>
>>>     (i. -: (| $ i.@:(*/)@:|)("1))Y
>>> 1
>>>
>>> This identity would also explain the padding (according to the entry for
>>> $).  In addition, the fact that JWithATwist implementation produces the
>>> same result (at least for Y=. 2 2 $ 1 2 3 4) suggests to me that the
>>> implementation is correct.
>>>
>>> By default, I assume the Dictionary is right and I am wrong. Where did I
>>> mess up?
>>>
>>>
>>> On Wed, Dec 13, 2017 at 3:46 AM, Erling Hellenäs <
>>> [email protected]>
>>> wrote:
>>>
>>> Yes.
>>>>
>>>>     (2 2 $ 1 2 3 4)
>>>> 1 2
>>>> 3 4
>>>>     i.1 2
>>>> 0 1
>>>>     i.3 4
>>>> 0 1  2  3
>>>> 4 5  6  7
>>>> 8 9 10 11
>>>>     (i.1 2),: i.3 4
>>>> 0 1  0  0
>>>> 0 0  0  0
>>>> 0 0  0  0
>>>>
>>>> 0 1  2  3
>>>> 4 5  6  7
>>>> 8 9 10 11
>>>>      i. (2 2 $ 1 2 3 4)
>>>> 0 1  0  0
>>>> 0 0  0  0
>>>> 0 0  0  0
>>>>
>>>> 0 1  2  3
>>>> 4 5  6  7
>>>> 8 9 10 11
>>>>
>>>> I tried to describe this behavior in section "The Monadic Array
>>>> Operation
>>>> Helper Program" in this manual:
>>>>
>>>> https://github.com/andrimne/JWithATwist.DocBook/raw/master/
>>>> target/en/JWithATwistReferenceManual.pdf
>>>>
>>>> As far as my tests show J and JWithATwist behaves the same in this
>>>> regard.
>>>>
>>>> I doubt you can find reasonably accurate descriptions of this
>>>> functionality (these four helper programs) anywhere else.
>>>>
>>>> To understand J you have to understand this functionality, as I see it.
>>>> It
>>>> is essential in everything you do in J.
>>>>
>>>> Cheers,
>>>>
>>>> Erling Hellenäs
>>>>
>>>>
>>>>
>>>>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to