Henry:

You're right.  I think it may depend on the exact form of the exponent
(e.g. if it is i.n or something like it rather than n1 n2 n3... for random
integers) but I cannot see why.

I get the same results with 1;2 and 1 2 as right argument.

   3 t1 1;2
+-+-----+
|2|2.2  |
+-+-----+
|3|2.42 |
+-+-----+
|4|2.662|
+-+-----+
   INFO_base_
2   2.2
2   2.2
3  2.42
4 2.662
   3 t1 1 2
+-+-----+
|2|2.2  |
+-+-----+
|3|2.42 |
+-+-----+
|4|2.662|
+-+-----+
   INFO_base_
2   2.2
2   2.2
3  2.42
4 2.662

Best wishes,

John


Henry Rich wrote:
> I don't think this explanation is right.  If you try
>
> 3 t1 1;2
>
> sel is invoked 4 times, not 6.  It looks like there is
> just one extra evaluation at the beginning.  And if you
> run
>
> 3 t1 1 2
>
> there is no extra evaluation, and sel is invoked only 3 times.
>
>
> All that is just as Fraser said it was.
>
> I tried using the new   sel^:(< >:x) form but that also did
> 1 extra evaluation.
>
> Henry Rich
>
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of John Randall
>> Sent: Thursday, June 08, 2006 9:29 PM
>> To: Beta forum
>> Subject: Re: [Jbeta] Power with Vector argument - a bug?
>>
>> Fraser:
>>
>> Here's the problem.
>>
>> The sentence
>>
>> 2 t1 1;2
>>
>> is going to invoke sel^:(1 2) 1;2.  This is equivalent to
>>
>> (sel^:1 (1;2)), (sel^:2 (1;2))
>>
>> In any case, sel is going to be invoked 3 times (not twice,
>> as you seem to
>> expect).  From the dictionary:
>>
>> Finally, u^:n y for an array n is produced by assembling u^:a
>> y (for all
>> the atoms a in n) into an overall result.
>>
>> If there are no side effects, it might be reasonable for J to
>> only do two
>> evaluations in sel^:(1 2) 1;2.  Since there are side effects,
>> I cannot see
>> a consistent interpretation that results in only two evaluations.
>>
>> If I understand what you want, you are probably better off
>> rewriting it so
>> that you invoke it as
>>
>> INFO_base_=: f^:<(>:n) init
>>
>> Here f is effectively ],(sel@:{:), so it applies sel to the
>> last row of
>> its argument, and appends the result to its argument.  You can also
>> rewrite this in other ways.  Since f is now a pure function, you don't
>> care how J calculates it.
>>
>> Best wishes,
>>
>> John
>>
>>
>>
>>
>> Fraser Jackson wrote:
>> > Thanks Henry, Raul and John for the helpful comments.  The following
>> > script
>> > reproduces the problem.  It seems to only occur when the
>> verb has a boxed
>> > argument.  The box characters below may not reproduce correctly.
>> >
>> >    t1 =: 4 : 0
>> > INFO_base_ =: 0 2$0
>> > sel^: (>:i.x)  y.
>> > )
>> >
>> >    sel =: 3 : 0
>> > 'r s' =. y.
>> > v =. (>:r), 1.1*s
>> > INFO_base_ =: INFO_base_ , v
>> > <"0 v
>> > )
>> >
>> >    2 t1 1;2
>> > ????????
>> > ?2 ?2.2 ?
>> > ????????
>> > ?3?2.42?
>> > ????????
>> >    INFO_base_
>> > 2  2.2
>> > 2  2.2
>> > 3 2.42
>> >
>> > Taking the Dictionary sentences refering to scalar n and to
>> array n, one
>> > would expect the verb to be evaluated exactly n times for
>> both n and ,n.
>> > Whether the data is a boxed array or not should not modify that
>> > expectation.
>> >
>> > Fraser
>> >
>> >
>> ----------------------------------------------------------------------
>> > 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
>


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to