Already tested that. Here's what I have:
sigmaTestO=: 4 : 0
if. 0=x do.1 return.end.
if. 0=#y do.0 return.end.
fs=.x(>:#])y
f=.{.fs
fs=.}.fs
if. (x-f) sigmaTestO fs do.1 return.end.
x sigmaTestO fs
)
This what I do with the tacit version if I move
fs=.x(>:#])y
to the first line of sigmaTestO.
Hallo Raul Miller, je schreef op 29-01-10 17:24:
> 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,
>
>
--
Met vriendelijke groet,
=@@i
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm