Indices: Difference between revisions

Jump to navigation Jump to search
17 bytes added ,  08:07, 5 June 2020
m (Text replacement - "{{APL built-ins}}" to "{{APL built-ins}}Category:Primitive functions")
Line 56: Line 56:
Indices on a [[vector]] is closely related to [[Replicate]]: for vectors <source lang=apl inline>V</source> and <source lang=apl inline>W</source>, we have <source lang=apl inline>⍸V</source> {{←→}} <source lang=apl inline>V/⍳≢V</source> and <source lang=apl inline>V⌿X</source> {{←→}} <source lang=apl inline>X[⍸V]</source>. While Replicate performs a transformation on another array, Indices gives a representation of that transformation using [[Index|indices]]. The relationship between Indices and Replicate parallels that between [[Grade]] and [[Sort By]].
Indices on a [[vector]] is closely related to [[Replicate]]: for vectors <source lang=apl inline>V</source> and <source lang=apl inline>W</source>, we have <source lang=apl inline>⍸V</source> {{←→}} <source lang=apl inline>V/⍳≢V</source> and <source lang=apl inline>V⌿X</source> {{←→}} <source lang=apl inline>X[⍸V]</source>. While Replicate performs a transformation on another array, Indices gives a representation of that transformation using [[Index|indices]]. The relationship between Indices and Replicate parallels that between [[Grade]] and [[Sort By]].


[[K]] takes advantage of this relationship by removing the primitive Replicate entirely: the glyph <code>&</code> is paired with [[Minimum]] instead. In K, Replicate is performed by using Where and then [[indexing]].
[[K]] takes advantage of this relationship by removing the primitive Replicate entirely: the glyph <code>&</code> is paired with [[Minimum]] instead. In K, Replicate is performed by using Where and then [[Bracket indexing|indexing]].


== History ==
== History ==
trusted
183

edits

Navigation menu