On Fri, Mar 8, 2013 at 2:41 AM, Linda Alvord <[email protected]> wrote:
> What does this do?
>
> ([: i.&0 /:)
The left verb here is the empty verb, so we need the monadic
definitions of the middle verb.
In i.&0 we have a verb and a noun, so & means that we are binding that
noun to that verb. So it's i. with a right argument of 0.
So, the middle verb here finds the [first] index of 0 in its argument.
The right verb is grade up, which finds us the indices that we can use
to select the values of a list in sorted order.
/: 'ABC'
0 1 2
/: 'CDB'
2 0 1
So the index of a zero in its result is the index of the first element
of the original list in the result.
In other words I think this should always have a result of 1:
({. A) -: ([: i.&0 /:) A=: ?~ 100
Note however that ({. A) -: ([: i.&0 /:) A might be false (zero) if
(/:~ -: i.@#) A is false.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm