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$?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 7

5 10 48 16 37


45 fixv p

2 1 1


If there were more than one match, what should the output be?


Skip Cave
Cave Consulting LLC


On Tue, Dec 26, 2023 at 7:48 PM LdBeth <andp...@foxmail.com> wrote:

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 <CAMw+KcroqQ4g=
o4rkystuqvjqqqtfxpqjy38zwarncd_ttl...@mail.gmail.com>
   David Pinchbeck <dpinc...@gmail.com> 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

5 6 7 8 9

10 11 12 13 14

15 16 17 18 19

20 21 22 23 24


(<1 3){A

8

How do I write a verb f to do the reverse, so that
8 f A
yields the result 1 3  ?

Thanks,
David
--
David Pinchbeck
Associate Professor of Mathematics
St. Joseph's College
Standish, ME
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

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

Reply via email to