Rob Hodgkinson wrote:
> If the exercise is to find the index, remember the existing dyad verb i.
>    9 4 6 i. 4
> 1
>
> If the exercise is a tacit solution...
>    idxof =: = # ([EMAIL PROTECTED]@[)
>    9 4 6 idxof 4
> 1
>
> NB: Does not handle a 'list' right argument (as indexOf also fails here)
>
>
Handling RA list

   9 4 6 idxof"(_ 0) 4 4 6
1
1
2

J4F, more tacit:

   ix=: [:I.]=[
   9 4 6 ix"(_ 0) 4 4 6
1
1
2


+---+----------+
|@@i|a.{~q:9991|
+---+----------+





----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to