Terrance wrote:
 
> One optimization I would like to see is removing the need to use
> special operators to avoid multiple independant passes over an
> array. One of the first questions I ever asked here had to do with
> the forked definition of average;
>
> avg =: +/  % #
> 
> and noted that an imperative language would iterate over the input
> data once, whereas here we have two iterations over it, one for
> +/ the other for #

Although Raul has pointed out that the result of # does not involve
iteration, we very frequently encounter trains where the values within
the same cells need to be involved in different ways.  As an arbitrary
example I here create the fork (*/ % +/)
 
It is inaccurate to say that J thereby specifies multiple independent
passes over the argument.  Instead, J makes no specification whatsoever
*how* the transformations shall be resolved.  J code tends to specify
simply *what* shall occur.  Whether that is accomplished in two passes
through the array, or through a single iteration, or through no
iterations at all, is simply unspecified.
 
I recognize that you have a strong interest in implementation.  In
itself, that is no problem.  It would be unfortunate, though, if your
ability to work with J remains closely coupled to your interest in how
any given J interpreter accomplishes things.
 
The beauty of J lies in its high degree of abstraction.  I encourage you
to envision J more as a notation, e.g. a replacement for traditional
mathematical notation, and less as something that results in a sequence
of alterations in machine state.
 
 
Tracy Harms
 
 
 
 
  
 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to