2,963
edits
(Add Replicate to introduction) |
|||
Line 1: | Line 1: | ||
:''This page describes a primitive whose result is a list of indices. See [[Index]] for the page on indices themselves. See [[Iota]] for the index generator.'' | :''This page describes a primitive whose result is a list of indices. See [[Index]] for the page on indices themselves. See [[Iota]] for the index generator.'' | ||
{{Built-in|Indices|⍸}}, or '''Where''', is a [[monadic]] [[primitive function]] which returns the [[Index|indices]] of all ones in a [[Boolean]] array. More generally, Indices accepts an array of non-negative integers and copies each index the corresponding number of times. | {{Built-in|Indices|⍸}}, or '''Where''', is a [[monadic]] [[primitive function]] which returns the [[Index|indices]] of all ones in a [[Boolean]] array. More generally, Indices accepts an array of non-negative integers and copies each index the corresponding number of times. It is closely related to [[Replicate]], and may be seen as an index-based equivalent to Replicate in the same way that [[Grade]] is an index-based equivalent of sorting. | ||
In [[K]], the first language to include the primitive, it is called Where (<source lang=k inline>&</source>). In [[J]], it is called Indices (<source lang=j inline>I.</source>). | In [[K]], the first language to include the primitive, it is called Where (<source lang=k inline>&</source>). In [[J]], it is called Indices (<source lang=j inline>I.</source>). |