With p defined as
p=.3 4 5$?.60$50 NB. ?.
33 (($@])#:[(I.@:=),@]) p
0 2 0
2 1 1
2 3 1
~ Gilles
Le 2023-12-26 à 21:06, 'Skip Cave' via Programming a écrit :
What would a general "find the index of the value x in the array y" verb
named fixv look like?
It would work like this:
] p=.3 4 5$?6
What would a general "find the index of the value x in the array y" verb
named fixv look like?
It would work like this:
] p=.3 4 5$?60$50
10 49 11 0 4
39 33 34 32 38
49 24 43 36 41
1 21 11 14 27
7 28 38 9 26
24 42 39 12 3
8 28 33 1 4
46 40 7 49 0
10 8 49 37 39
5 45 46 39 6
7 38 32 2
This is related to the question I asked several days ago,
http://jsoftware.com/pipermail/programming/2023-December/062994.html
My suggestion would be
8 (($@])#:[i.~,@]) A
1 3
Although you might want to an alternative behavior when there are
multiple matches.
LdBeth :)
> In
> Davi
8 ($@] #: [ I.@:= ,@]) A
1 3
8 (4 $. $.@:= ) A
1 3
Note that both of these results are rank 2.
--
Raul
On Tue, Dec 26, 2023 at 8:32 PM David Pinchbeck wrote:
>
> Having trouble finding this in the wiki: I know that we can select from a
> table using a boxed pair
>
> A
>
> 0 1 2 3 4
>
>