Find: Difference between revisions
Content added Content deleted
(add dict version) |
("Better category ordering, add redirects to categories, fix pseudo-adverb categories") |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{primitive|x |
{{primitive|x?y}} |
||
The '''find''' primitive is used to find the index of an atom <code>y</code> in array <code>x</code>. It returns <code>0N</code> if the element is not found. |
The '''find''' primitive is used to find the index of an atom <code>y</code> in array <code>x</code>. It returns <code>0N</code> if the element is not found. |
||
Line 16: | Line 16: | ||
`c`b |
`c`b |
||
</pre> |
</pre> |
||
== K3 == |
|||
In K3, Find is [[atomicity|non-atomic.]] It considers <code>y</code> as a single unit, and will return a single index for it. <code>?/:</code> is needed to simulate the functionality of later Ks. |
|||
[[Category:Verbs]] |
|||
[[Category:Named verbs]] |
|||
[[Category:Operator verbs]] |
|||
[[Category:Primitives]] |
Latest revision as of 06:40, 9 July 2022
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
K3[edit]
In K3, Find is non-atomic. It considers y
as a single unit, and will return a single index for it. ?/:
is needed to simulate the functionality of later Ks.