What is the right argument to IntrinsicRank supposed to be? For example in

fibonacci=:3 :0 b: 0
 y{(,+/@{.~&_2)^:(>./,y) 0 1
)

what does the 0 actually do?

If you want the user to be able to inform the interpreter that a J
verb can efficiently compute its result over different ranks then it
seems to me that you would need the following:

1. A flag marking the derived verb as having IRS.
2. The implementation of rank checks the flag and if it is marked rank
does not handle the the creation of the result cells but instead
passes the entire argument to the verb.
3!. But now the verb needs to know at what rank it is being called. So
there needs to be a way to pass that to the J verb. I don't know how
this would happen; maybe 9!: foreign that returns the rank?



On Wed, Jun 13, 2012 at 12:19 PM, Raul Miller <[email protected]> wrote:
> On Wed, Jun 13, 2012 at 11:49 AM, Roger Hui <[email protected]> wrote:
>> I don't know whether the following is what you mean by "intrinsic rank".
>>
>> Certain (quite a few) primitives are implemented by code that "know" what
>> their ranks are supposed to be and know that they are currently invoked via
>> the rank operator with particular ranks.  For example, if you say  2{."1 x
>> the C function that implements "take" is given the 2 and the x *in toto *and
>> "know" that it's being called with rank 1*.  *You can see the effect of
>> this by doing a benchmark:
>>
>>   take=: {.
>>   x=: 50 1e5 ?@$ 0
>>
>>   ts '2 {."1 x'
>> 1.4527e_5 1920
>>   ts '2 take"1 x'
>> 0.0209496 1.05082e6
>>
>> This is called "Integrated Rank Support" in
>> http://www.jsoftware.com/papers/rank.htm .
>
> Yes, "Integrated Rank Support" is the term I should have used.
>
> Currently that mechanism is not available for user definitions.  But I
> think it should be.
>
> Thank you,
>
> --
> Raul
> ----------------------------------------------------------------------
> 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