Simple examples: Difference between revisions
Jump to navigation
Jump to search
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 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 class="apl">⍸</source> gives us the indices where true (1): | ||
<source lang=apl> | <source lang=apl> | ||
⍸'mississippi'∊'sp' | ⍸'mississippi'∊'sp' |