Use longer vectors to bring the differences into sharper relief.


----- Original Message ----- 
From: "Henry Rich" <[EMAIL PROTECTED]>
To: "'Programming forum'" <[email protected]>
Sent: Thursday, May 25, 2006 2:31 PM
Subject: RE: [Jprogramming] Does (f g h) sneak a peek at f?

That was exactly the test I ran on nbeta, but I got a different
result:

   f =. [:
   x=: 1e3 [EMAIL PROTECTED] 1e4
   y=: 1e3 [EMAIL PROTECTED] 1e4
   ts 'x ([: +/ >) y'
1.05261e_5 1344
   ts 'x (f +/ >) y'
1.39045e_5 3584

Is your version different?

Henry Rich 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Roger Hui
> Sent: Thursday, May 25, 2006 3:24 PM
> To: Programming forum
> Subject: Re: [Jprogramming] Does (f g h) sneak a peek at f?
> 
> > Experimentation reveals that (f +/ >) above uses the fast
> > code for ([: +/ >), so somehow the initial execution of the
> > hook looked at the value of f, even though only its name is
> > supposed to be available.
> 
> Actually, it does not use the special code for ([: +/ >) :
> 
>    x=: 1e6 [EMAIL PROTECTED] 0
>    y=: 1e6 [EMAIL PROTECTED] 0
>    cap=: [:
>    ts=: 6!:2 , 7!:[EMAIL PROTECTED]
> 
>    ts 'x ([: +/ >) y'
> 0.117277 1344
>    ts 'x (cap +/ >) y'
> 0.13848 1.05011e6
> 
> The array result is the same, of course.
> 
>    x ([: +/ >) y
> 500393
>    x (cap +/ >) y
> 500393


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

Reply via email to