I believe there a bug in special code for integer, this worked ok _1 _1 E. (2.1-2.1)+ ( (2 -/\ ])) a2v'abcdddoz' 1 1 0 0 0 0 0
Пт, 11 дек 2015, jprogramming написал(а): > its a weird hang, in that jqt is responsive (can use the editor) > > > can reproduce with: > > _1 _1 E. ( (2 -/\ ])) a2v'abcdddoz' > > _1 _1 E."1 ( (2 -/\ ])) a2v'abcdddoz' > > _1 _1 E. 0 , ( (2 -/\ ])) a2v'abcdddoz' > > a workaround, > > +./@:(2 (=/ *. _1 = {.)\ ])@:(2 -/\ ]) a2v'abcdddoz' > > > ----- Original Message ----- > From: David Lambert <b49p23t...@gmail.com> > To: programming <programm...@jsoftware.com> > Sent: Friday, December 11, 2015 2:48 AM > Subject: [Jprogramming] adventofcode 11 > > 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 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm -- regards, ==================================================== GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm