Simple examples: Difference between revisions

Jump to navigation Jump to search
4 bytes added ,  09:07, 29 October 2019
m
Text replacement - "</code>" to "</source>"
Miraheze>Marshall
No edit summary
Miraheze>Adám Brudzewsky
m (Text replacement - "</code>" to "</source>")
Line 3: Line 3:
APL represents text as character lists (vectors), making many text operations trivial.
APL represents text as character lists (vectors), making many text operations trivial.
=== Indices of multiple elements ===
=== Indices of multiple elements ===
<code class="apl">∊</code> gives us a mask for elements (characters) in the left argument that are members of the right argument:
<code class="apl">∊</source> gives us a mask for elements (characters) in the left argument that are members of the right argument:
<source lang=apl>
<source lang=apl>
       'mississippi'∊'sp'
       'mississippi'∊'sp'
0 0 1 1 0 1 1 0 1 1 0
0 0 1 1 0 1 1 0 1 1 0
</source>
</source>
<code class="apl">⍸</code> gives us the indices where true (1):
<code class="apl">⍸</source> gives us the indices where true (1):
<source lang=apl>
<source lang=apl>
       ⍸'mississippi'∊'sp'
       ⍸'mississippi'∊'sp'

Navigation menu