Is this bug the same as

   13 : 'y+y'
+

?

On Fri, Sep 2, 2011 at 7:07 AM, Raul Miller <[email protected]> wrote:

> On Fri, Sep 2, 2011 at 3:01 AM, Joey K Tuttle <[email protected]> wrote:
> > Happily, it gives the same result as oof (even though complicated and
> > obscure...)  My use of the temporary z was just sloppiness - but I
> > didn't notice that until I was flummoxed by making a tacit form -
> >
> >    hooft =: 13 : '+/"1 ((i.y+1) =/ +/"1 z) [ z =. #: i. 2^y'
> >
> > and discovering that it produces a very different result (displaying
> > the shape is sufficient to show that without wasting space).
> >
> >    $hooft 6
> > 7 64 7
> >
> > So clearly, 13 : failed. This rings a bell of something similar being
> > reported before, but maybe it is different. I haven't succeeded in a
> > simple expression that goes wrong in the same way. I'm sure someone
> > in the forum can provide a tacit form that is similar, but works
> > correctly - something other than -
>
> You can make that long expression tacit by breaking out the expression
> which finds z:
>   13 : 'z =. #: i. 2^y'
> [: #: [: i. 2 ^ ]
>
> At this point the remaining expression has two variables: y and z.
> This suggests using a hook for a monadic context.  So we can replace y
> wiith x and z with y:
>
>   13 : '+/"1 ((i.x+1) =/ +/"1 y)'
> [: +/"1 ([: i. 1 + [) =/ [: +/"1 ]
>
> And then we plug the two phrases back into the parenthesis of (() ()):
>
>   (([: +/"1 ([: i. 1 + [) =/ [: +/"1 ])([: #: [: i. 2 ^ ])) 6
> 1 6 15 20 15 6 1
>
> Also, here is a simpler expression which probably illustrates the same
> problem:
>
>   '; ((y+1) ; , z) [ z =. 2+y'
>
> I found this by defining:
>   expr=: 1 :'((3 :m),&<(13 :m))'
>
> And then experimenting with sentences like:
>   $&.> 'experiment' expr 6
> until I had found a short one and then switching to
>   'experiment' expr 3
> to simplify it further.
>
> FYI,
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to