Find: Difference between revisions

From The K Language Wiki
Content added Content deleted
(add find page)
 
(add dict version)
Line 10: Line 10:
5 8 5?56 8 1 5
5 8 5?56 8 1 5
0N 1 0N 0
0N 1 0N 0
</pre>
For dictionaries, returns the keys associated with the given values:
<pre>
(`a`b`c`d!23 14 9 5)?9 14
`c`b
</pre>
</pre>

Revision as of 06:51, 20 July 2021

Find
x&y

The find primitive is used to find the index of an atom y in array x. It returns 0N if the element is not found.

Find is right atomic.

 "XYZ"?"XYXZB"
0 1 0 2 0N
 5 8 5?56 8 1 5
0N 1 0N 0

For dictionaries, returns the keys associated with the given values:

 (`a`b`c`d!23 14 9 5)?9 14
`c`b