Explicit:  I.x=y   ; tacit: I.@:=  , with the latter being supported
by special code.

   x=: 1e6 [EMAIL PROTECTED] 5e5
   y=: ? 5e5
   ts=: 6!:2 , 7!:[EMAIL PROTECTED]

   ts 'I. x=y'
0.00606027 1.04922e6
   ts 'x I.@:= y'
0.0024654 524992

http://www.jsoftware.com/help/release/edot504.htm



----- Original Message -----
From: "metaperl.j" <[EMAIL PROTECTED]>
Date: Tuesday, October 9, 2007 5:04
Subject: [Jgeneral] finding the index of an element in a list
To: [email protected]

> I would be interested in seeing an explicit solution to this... 
> implicitwould be interesting, but I mainly want to see the 
> explicit solution:
> 
> NB. find the index of a value in a list
> NB. list indexOf value
> NB. 9 4 6 indexOf 4   would yield 1
> indexOf =: 4 : 0
> indices =: i. # x
> tally_map =: value = y
> tally_map # indices
> )
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to