On Fri, Jan 29, 2010 at 9:18 AM, Aai <[email protected]> wrote:
> Right, here it functions as an optimization. Applied in Haskell it's of
> no noticeable influence.
I understand that -- the Haskell version uses laziness to achieve
a better optimization here.
However, you might want to try something like this:
sigmaTest=: 4 : 0
if. 0=x do.1 return.end.
if. 0=#y do.0 return.end.
f=.{.y
fs=.x(>:#])}.y
if. x<f do. x sigmaTest fs return.end.
if. (x-f) sigmaTest fs do.1 return.end.
x sigmaTest fs
)
This is still slower than the tacit version,
but it's faster than the unoptimized
version.
FYI,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm