[Jprogramming] Strange 13 : '...' behavior

Louis de Forcrand olius at bluewin.ch
Wed Dec 28 00:13:09 UTC 2016


d doesn’t appear in the result of 13 : because d is defined locally in a.
In my previous experience of 13 :, it does its best to “factor” intermediate
values like d with trains, but here it seems to have slipped up and treated
a as dyadic. 13 : should have returned

] (([: a [: a ]) + [: a [ - a) <:

instead of

] (([: a    a  ) + [: a [ - a) <:

Louis

> On 28 Dec 2016, at 01:05, 'Pascal Jasmin' via Programming <programming at jsoftware.com> wrote:
> 
> d is a noun in 3 :
> it does not appear in result of 13
> 
> 13 : is buggy.  The tacit version you want is
> 
> a =: (a@:a@:<: +   ] a@:([ - a@]) <:)`1:@.(<:&2)
> 
> 
> 
> ----- Original Message -----
> From: Louis de Forcrand <olius at bluewin.ch>
> To: programming at jsoftware.com
> Sent: Tuesday, December 27, 2016 6:07 PM
> Subject: [Jprogramming] Strange 13 : '...' behavior
> 
> From: http://rosettacode.org/wiki/Hofstadter-Conway_$10,000_sequence <http://rosettacode.org/wiki/Hofstadter-Conway_$10,000_sequence>
> 
>   JVERSION
> Engine: j805/j64/darwin
> Beta-12: commercial/2016-09-30T16:11:35
> Library: 8.05.07
> Platform: Darwin 64
> Installer: J805 install
> InstallPath: /users/louisdeforcrand/applications/j64-805
> Contact: www.jsoftware.com
>   a=: 3 : '(a a d)+a y-a d=.<:y'`1:@.(<:&2) 
>   a"0>:i.10 NB. correct behavior
> 1 1 2 2 3 4 4 4 5 6
>   a=: 13 : '(a a d)+a y-a d=.<:y'`1:@.(<:&2)
>   a"0>:i.10 NB. incorrect behavior
> 1 1 2 3 4 5 6 7 8 9
>   a
> (] (([: a a) + [: a [ - a) <:)`1:@.(<:&2)
> 
> Anybody know what’s going on?
> 
> Louis
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list