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