I have changed it so that (f g h) uses the same fast code that is
available to ([: g h), once it is determined that  f f.  is  [: .  
As a consequence the execution of [: g h is also theoretically 
(though not measurably) faster.  



----- Original Message ----- 
From: "Roger Hui" <[EMAIL PROTECTED]>
To: "Programming forum" <[email protected]>
Sent: Thursday, May 25, 2006 12:23 PM
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