Jan,
The following is tacit and fairly elegant:
n =. ' accept state stateNew yields '
d =. 1 0 1 1 0 1 2 3 5 5 5 5 0 5 2 3
(n) =. _2 ]\^:2 d
yields -: {.`}. } accept , stateNew ,: state
1
But, as Roger pointed out, depending on how you obtain each of the
parts "accept", "state", "statenew", an explicit solution can be
significantly faster:
yields -: accept 4 : 'y =. x} 5 ,: y' state
1
If the noun state is or could be mapped (i.e. JMF), elide the y=.
part. Also ensure that 'boolean' -: datatype accept for fastest
results.
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm