FinnAPL idiom library: Difference between revisions
Jump to navigation
Jump to search
no edit summary
Miraheze>Adám Brudzewsky No edit summary |
Miraheze>Adám Brudzewsky No edit summary |
||
Line 20: | Line 20: | ||
The entry includes a brief description of what the idiom does, which is followed by the expression <source lang=apl inline>X←A1; Y←A1</source> which specifies the types and ranks of the arguments: | The entry includes a brief description of what the idiom does, which is followed by the expression <source lang=apl inline>X←A1; Y←A1</source> which specifies the types and ranks of the arguments: | ||
{|class=wikitable | |||
|<source lang=apl inline>A</source>||Any [Numeric, Character or Boolean] | |||
|- | |||
|<source lang=apl inline>D</source>||Numeric | |||
|- | |||
|<source lang=apl inline>I</source>||Integer | |||
|- | |||
|<source lang=apl inline>C</source>||Character | |||
|- | |||
|<source lang=apl inline>B</source>||Boolean | |||
|} | |||
A number following the type indicates the rank, e.g. | A number following the type indicates the rank, e.g. | ||
{|class=wikitable | |||
|<source lang=apl inline>A0</source>||Any scalar (rank 0) | |||
|- | |||
|<source lang=apl inline>A1</source>||Any vector (rank 1) | |||
Thus the idiom shown expects two character or numeric vectors, X and Y. It will find the index position of each element of Y in X, for example: | |- | ||
|<source lang=apl inline>A2</source>||Any matrix (rank 2) | |||
|} | |||
Thus the idiom shown expects two character or numeric vectors, <source lang=apl inline>X</source> and <source lang=apl inline>Y</source>. It will find the index position of each element of <source lang=apl inline>Y</source> in <source lang=apl inline>X</source>, for example: | |||
<source lang=apl> | <source lang=apl> | ||
Line 42: | Line 51: | ||
</source> | </source> | ||
In this example, the first 'o' character in Y occurs in at index position 13 in X, the second one occurs at position 20, and the third and fourth 'o' characters are not present in X. | In this example, the first 'o' character in <source lang=apl inline>Y</source> occurs in at index position 13 in <source lang=apl inline>X</source>, the second one occurs at position 20, and the third and fourth 'o' characters are not present in <source lang=apl inline>X</source>. | ||
For a more detailed description of how this particular idiom works, see [http://www.sudleyplace.com/APL/AnatomyOfAnIdiom.ahtml this analysis] by Bob Smith. | For a more detailed description of how this particular idiom works, see [http://www.sudleyplace.com/APL/AnatomyOfAnIdiom.ahtml this analysis] by Bob Smith. | ||
== Idiom Library Listing == | == Idiom Library Listing == | ||
=== Grade Up ⍋ === | === Grade Up <code>⍋</code> === | ||
{|class=wikitable style="background-color: #EBEBEB" | {|class=wikitable style="background-color: #EBEBEB" | ||
|rowspan=2|1. || Progressive index of (without replacement) ||style="text-align: right;"|<source lang=apl inline>X←A1; Y←A1</source> | |rowspan=2|1. || Progressive index of (without replacement) ||style="text-align: right;"|<source lang=apl inline>X←A1; Y←A1</source> |