John Randall wrote:


Sorry: this is wrong too.  Funning a few test cases suggests

(a) There is a mysterious extra evaluation.

(b) For f^:(n0 n1 n2 n3 ....nn) y, f gets evaluated an additional number
of times equal to the maximum of n0,...,nn, regardless of the side
effects.

I think ^: is really designed for pure functions.

(b) does not accord with my experiments. I always get f evaluated (1+>./n0,n1,n2,.,nn) times when the number of increments to INFO_base_ differs from the value of the power. Roger's code obviously processes the vector of powers to minimise the processing time. The function must obviously be called >./ (n0,n1,..,nn) times. The extra evaluation is always at the beginning and I suspect the additional initial evaluation is to assist in assembly of the results.

However I also suspect that it could be coded so the additional evaluation did not occur and I hope Roger will do that.

In the meantime I will rewrite the function to call and pass a state variable which I was tracking with INFO_base_ as well as the values of the function thus avoiding the side effects.

Fraser





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

Reply via email to