[Jprogramming] adventofcode 11

Arie Groeneveld agroeneveld400 at gmail.com
Fri Dec 11 12:30:40 UTC 2015


Applying straight the following pattern is the killerwhen using _1 _1 E. y

2 -/\0 1 2 3 3 3 14 25

_1 _1 _1 0 0 _11 _11


There is a bug mentioned in nuvoc E. (so who knows).







Op 11-12-2015 om 08:48 schreef David Lambert:
> In the session below, the final sentence
> valid A
> runs "forever".  Why?
>
> $ ijconsole
>
>    JVERSION
> Engine: j803/2014-10-19-11:11:11
> Library: 8.04.13
> Platform: Linux 64
> Installer: unknown
> InstallPath: /usr/share/j/8.0.4
>
>
>    LC=: 26}.Alpha_j_
>
>    a2v=: _8{.LC&i.
>
>    NB. these tests apply to numerical vectors.
>    straight=: 1 e. _1 _1 E. 2 -/\ ]
>    oil=: 1 e. 14 8 11&e.
>    pairs=: ((1 < {: - {.)*.(1 < #))@:([: I. 0 = 2 -/\ ])
>    valid=: straight *. -.@:oil *. pairs
>
>    TEST=:>;:'hijklmmn abbceffg abbcegjk abcdefgh abcdffaa ghijklmn 
> ghjaabcc'
>    ([: valid a2v)"1 TEST   NB. passes the small test suite.
> 0 0 0 0 1 0 1
>
>
>    [A=: a2v'abcdddoz'
> 0 1 2 3 3 3 14 25
>
>    valid A
> ^Z
> [1]+  Stopped                 ijconsole
> $
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list