FinnAPL idiom library: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
No edit summary
(One intermediate revision by the same user not shown)
Line 198: Line 198:
|colspan=2 style="background-color: #F5F5F5"|<source lang=apl inline>(X,'*')[(⎕IO+⍴X)⌊⍋(⍳⍴X),(Y×⍴G)⍴G]</source>
|colspan=2 style="background-color: #F5F5F5"|<source lang=apl inline>(X,'*')[(⎕IO+⍴X)⌊⍋(⍳⍴X),(Y×⍴G)⍴G]</source>
|- style="background-color: #FFFFFF"
|- style="background-color: #FFFFFF"
|rowspan=2| 36. || Median<ref>Note: it doesn't average the middle two elements as per median's definition.</ref> ||style="text-align: right;"|<source lang=apl inline>X←D1</source>
|rowspan=2| 36. || Median<ref>Note: it doesn't average the middle two elements as per median's definition. A more correct idiomatic expression is <source lang=apl inline>0.5×+/X[(⍋X)[|⌈¯0.5 0.5×1+⍴X]]</source></ref> ||style="text-align: right;"|<source lang=apl inline>X←D1</source>
|- style="background-color: #FFFFFF"
|- style="background-color: #FFFFFF"
|colspan=2 style="background-color: #FFFFFF"|<source lang=apl inline>X[(⍋X)[⌈.5×⍴X]]</source>
|colspan=2 style="background-color: #FFFFFF"|<source lang=apl inline>X[(⍋X)[⌈.5×⍴X]]</source>
Line 2,019: Line 2,019:
|colspan=2 style="background-color: #F5F5F5"|<source lang=apl inline>(¯1⌽1↓(X≠¯1⌽X),1)/X</source>
|colspan=2 style="background-color: #F5F5F5"|<source lang=apl inline>(¯1⌽1↓(X≠¯1⌽X),1)/X</source>
|- style="background-color: #FFFFFF"
|- style="background-color: #FFFFFF"
|rowspan=2| 491. || An expression giving itself ||style="text-align: right;"|<source lang=apl inline></source>
|rowspan=2| 491. || [[Quine|An expression giving itself]] ||style="text-align: right;"|<source lang=apl inline></source>
|- style="background-color: #FFFFFF"
|- style="background-color: #FFFFFF"
|colspan=2 style="background-color: #FFFFFF"|<source lang=apl inline>1⌽22⍴11⍴'''1⌽22⍴11⍴'''</source>
|colspan=2 style="background-color: #FFFFFF"|<source lang=apl inline>1⌽22⍴11⍴'''1⌽22⍴11⍴'''</source>

Revision as of 06:10, 14 August 2020

The original FinnAPL idiom library

The FinnAPL idiom library contains a collection of over 700 one-line APL idioms to accomplish a large variety of tasks. It was first presented at the 1984 APL conference in Helsinki, Finland. The huge contribution of the Finnish APL Association is gratefully acknowledged.

This listing mainly suffers from two issues:

  • Due to its age, it doesn't make use of modern APL features which can provide a simpler solution. (However, a simple-looking expression which uses nested arrays might be far more computationally expensive than a longer, more involved solution which only uses simple arrays.)
  • It can be hard to find what one is looking for, both because computing terminology has changed, and because pinpointing the exact term can be difficult.

APLcart includes all of the below library, updated to use the latest language features, and in an easily searchable format that includes modern day synonyms.

Interpreting an entry in the Idiom Library

As an example of how each entry in the library is arranged, consider the first idiom:

1. Progressive index of (without replacement) X←A1; Y←A1
((⍴X)⍴⍋⍋X⍳X,Y)⍳(⍴Y)⍴⍋⍋X⍳Y,X

The entry includes a brief description of what the idiom does, which is followed by the expression X←A1; Y←A1 which specifies the types and ranks of the arguments:

A Any [Numeric, Character or Boolean]
D Numeric
I Integer
C Character
B Boolean

A number following the type indicates the rank, e.g.

A0 Any scalar (rank 0)
A1 Any vector (rank 1)
A2 Any matrix (rank 2)

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:

      X←'which side does an ostrich have its feathers?'
      Y←'on the outside, of course!'
      ((⍴X)⍴⍋⍋X⍳X,Y)⍳(⍴Y)⍴⍋⍋X⍳Y,X
13 18 6 22 2 10 11 20 46 34 7 3 9 14 46 16 46 37 19 4 46 46 23 15 31 46
      (X,'-')[((⍴X)⍴⍋⍋X⍳X,Y)⍳(⍴Y)⍴⍋⍋X⍳Y,X]
on the o-tside- -f c--rse-

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.

For a more detailed description of how this particular idiom works, see this analysis by Bob Smith.

Idiom Library Listing

Grade Up

1. Progressive index of (without replacement) X←A1; Y←A1
((⍴X)⍴⍋⍋X⍳X,Y)⍳(⍴Y)⍴⍋⍋X⍳Y,X
2. Ascending cardinal numbers (ranking, shareable) X←D1
⌊.5×(⍋⍋X)+⌽⍋⍋⌽X
3. Cumulative maxima (⌈\) of subvectors of Y indicated by X X←B1; Y←D1
Y[A⍳⌈\A←⍋A[⍋(+\X)[A←⍋Y]]]
4. Cumulative minima (⌊\) of subvectors of Y indicated by X X←B1; Y←D1
Y[A⍳⌈\A←⍋A[⍋(+\X)[A←⍒Y]]]
5. Progressive index of (without replacement) X←A1; Y←A1
((⍋X⍳X,Y)⍳⍳⍴X)⍳(⍋X⍳Y,X)⍳⍳⍴Y
6. Test if X and Y are permutations of each other X←D1; Y←D1
Y[⍋Y]∧.=X[⍋X]
7. Test if X is a permutation vector X←I1
X∧.=⍋⍋X
8. Grade up () for sorting subvectors of Y having lengths X Y←D1; X←I1; (⍴Y) ←→ +/X
A[⍋(+\(⍳⍴Y)∊+\⎕IO,X)[A←⍋Y]]
9. Index of the elements of X in Y X←D1; Y←D1
(((1,A)/B)⌊1+⍴Y)[(⍴Y)↓(+\1,A←(1↓A)≠¯1↓A←A[B])[⍋B←⍋A←Y,X]]
10. Minima (⌊/) of elements of subvectors of Y indicated by X X←B1; Y←D1
Y[A[X/⍋(+\X)[A←⍋Y]]]
11. Grade up () for sorting subvectors of Y indicated by X X←B1; Y←D1
A[⍋(+\X)[A←⍋Y]]
12. Occurences of the elements of X X←D1
|-⌿(2,⍴X)⍴⍋⍋X,X
13. Sorting rows of matrix X into ascending order X←D2
(⍴X)⍴(,X)[A[⍋(,⍉(⌽⍴X)⍴⍳1↑⍴X)[A←⍋,X]]]
14. Adding a new dimension after dimension G Y-fold G←I0; Y←I0; X←A
(⍋⍋(G+1),⍳⍴⍴X)⍉(Y,⍴X)⍴X
15. Sorting rows of matrix X into ascending order X←D2
A←(⍋,X)-⎕IO ⋄ (⍴X)⍴(,X)[⎕IO+A[⍋⌊A÷¯1↑⍴X]]
16. Y smallest elements of X in order of occurrence X←D1, Y←I0
((⍋⍋X)∊⍳Y)/X
17. Merging X, Y, Z ... under control of G (mesh) X←A1; Y←A1; Z←A1; ... ; G←I1
(X,Y,Z,...)[⍋⍋G]
18. Merging X and Y under control of G (mesh) X←A1; Y←A1; G←B1
(X,Y)[⍋⍋G]
19. Ascending cardinal numbers (ranking, all different) X←D1
⍋⍋X
20. Grade down () for sorting subvectors of Y having lengths X Y←D1; X←I1; (⍴Y) ←→ +/X
A[⍋(+\(⍳⍴Y)∊+\⎕IO,X)[A←⍒Y]]
21. Maxima (⌈/) of elements of subvectors of Y indicated by X X←B1; Y←D1
Y[A[X/⍋(+\X)[A←⍒Y]]]
22. Grade down () for sorting subvectors of Y indicated by X X←B1; Y←D1
A[⍋(+\X)[A←⍒Y]]
23. Y largest elements of X in order of occurrence X←D1; Y←I0
((⍋⍒X)∊⍳Y)/X
24. Merging X and Y under control of G (mesh) X←A1; Y←A1; G←B1
(Y,X)[⍋⍒G]
25. Descending cardinal numbers (ranking, all different) X←D1
⍋⍒X
26. Sorting rows of X according to key Y (alphabetizing) X←A2; Y←A1
X[⍋(1+⍴Y)⊥Y⍳⍉X;]
27. Diagonal ravel X←A
(,X)[⍋+⌿(⍴X)⊤(⍳⍴,X)-⎕IO]
28. Grade up according to key Y Y←A1; X←A1
⍋Y⍳X
29. Test if X is a permutation vector X←I1
X[⍋X]∧.=⍳⍴X
30. Sorting a matrix into lexicographic order X←D2
X[⍋+⌿A<.-⍉A←X,0;]
31. Sorting words in list X according to word length X←C2
X[⍋X+.≠' ';]
32. Classification of X to classes starting with Y X←D1;Y←D1;Y<.≥1⌽Y
A[(B/C)-⍴Y]←B/+\~B←(⍴Y)<C←⍋Y,X+A←0×X ⋄ A
33. Rotate first elements (1⌽) of subvectors of Y indicated by X X←B1; Y←A1
Y[⍋X++\X]
34. Doubling quotes (for execution) X←C1
(X,'''')[(⎕IO+⍴X)⌊⍋(⍳⍴X),(''''=X)/⍳⍴X]
35. Inserting Y *'s into vector X after indices G X←C1; Y←I0; G←I1
(X,'*')[(⎕IO+⍴X)⌊⍋(⍳⍴X),(Y×⍴G)⍴G]
36. Median[1] X←D1
X[(⍋X)[⌈.5×⍴X]]
37. Index of last maximum element of X X←D1
¯1↑⍋X
38. Index of (first) minimum element of X X←D1
1↑⍋X
39. Expansion vector with zero after indices Y X←D1; Y←I1
(⍴X)≥⍋(⍳⍴X),Y
40. Catenating G elements H before indices Y in vector X X←A1; Y←I1; G←I0; H←A0
A←G×⍴,Y ⋄ ((A⍴H),X)[⍋(A⍴Y),⍳⍴X]
41. Catenating G elements H after indices Y in vector X X←A1; Y←I1; G←I0; H←A0
A←G×⍴,Y ⋄ (X,A⍴H)[⍋(⍳⍴X),A⍴Y]
42. Merging X and Y under control of G (mesh) X←A1; Y←A1; G←B1
A[⍋G]←A←Y,X ⋄ A
43. Sorting a matrix according to Y:th column X←D2
X[⍋X[;Y];]
44. Sorting indices X according to data Y X←I1; Y←D1
X[⍋Y[X]]
45. Choosing sorting direction during execution X←D1; Y←I0
⍋X×(¯1 1)[Y]
46. Sorting Y according to X X←A1; Y←A1
Y[⍋X]
47. Sorting X into ascending order X←D1
X[⍋X]
48. Inverting a permutation X←I1
⍋X

Grade Down

49. Reverse vector X on condition Y X←A1; Y←B0
X[⍒Y!⍳⍴X]
50. Sorting a matrix into reverse lexicographic order X←D2
X[⍒+⌿A<.-⍉A←X,0;]
52. Reversal () of subvectors of X having lengths Y X←D1; Y←I1
X[⌽⍒+\(⍳⍴X)∊+\⎕IO,Y]
53. Reversal () of subvectors of Y indicated by X X←B1; Y←A1
Y[⌽⍒+\X]
55. Indices of ones in logical vector X X←B1
(+/X)↑⍒X
56. Index of first maximum element of X X←D1
1↑⍒X
57. Moving all blanks to end of text X←C1
X[⍒' '≠X]
58. Sorting X into descending order X←D1
X[⍒X]
59. Moving elements satisfying condition Y to the start of X X←A1; Y←B1
X[⍒Y]

Matrix Inversion / Matrix Division

60. Interpolated value of series (X,Y) at G X←D1; Y←D1; G←D0
G⊥Y⌹X∘.*⌽-⎕IO-⍳⍴X
61. Predicted values of exponential (curve) fit X←D1; Y←D1
*A+.×(⍟Y)⌹A←X∘.*0 1
62. Coefficients of exponential (curve) fit of points (X,Y) X←D1; Y←D1
A←(⍟Y)⌹X∘.*0 1 ⋄ A[1]←*A[1] ⋄ A
63. Predicted values of best linear fit (least squares) X←D1; Y←D1
A+.×Y⌹A←X∘.*0 1
64. G-degree polynomial (curve) fit of points (X,Y) X←D1; Y←D1
⌽Y⌹X∘.*0,⍳G
65. Best linear fit of points (X,Y) (least squares) X←D1; Y←D1
Y⌹X∘.*0 1

Decode

66. Binary format of decimal number X X←I0
⍕10⊥((1+⌈2⍟⌈/,X)⍴2)⊤X
67. Barchart of two integer series (across the page) X←I2; 1⍴⍴X ←→ 2
' *○⍟'[⎕IO+2⊥X∘.≥⍳⌈/,X]
68. Case structure with an encoded branch destination Y←I1; X←B1
→Y[1+2⊥X]
69. Representation of current time (24 hour clock)
A←⍕1000⊥3↑3↓⎕TS ⋄ A[3 6]←':' ⋄ A
70. Representation of current date (descending format)
A←⍕1000⊥3↑⎕TS ⋄ A[5 8]←'-' ⋄ A
71. Representation of current time (12 hour clock)
(1⌽,' ::',3 2⍴6 0⍕100⊥12 0 0|3↑3↓⎕TS),'AP'[1+12≤⎕TS[4]],'M'
73. Removing duplicate rows X←A2
((A⍳A)=⍳⍴A←2⊥X∧.=⍉X)⌿X
74. Conversion from hexadecimal to decimal X←C
16⊥-⎕IO-'0123456789ABCDEF'⍳⍉X
75. Conversion of alphanumeric string into numeric X←C1
10⊥¯1+'0123456789'⍳X
76. Value of polynomial with coefficients Y at points X X←D1; Y←D1
(X∘.+,0)⊥Y
77. Changing connectivity list X to a connectivity matrix X←C2
A←(×/B←0 0+⌈/,X)⍴0 ⋄ A[⎕IO+B[1]⊥-⎕IO-X]←1 ⋄ B⍴A
78. Present value of cash flows X at interest rate Y % X←D1; Y←D0
(÷1+Y÷100)⊥⌽X
79. Justifying right X←C
(1-(' '=X)⊥1)⌽X
80. Number of days in month X of years Y (for all leap years) X←I0; Y←I
(12⍴7⍴31 30)[X]-0⌈¯1+2⊥(X=2),[.1](0≠400|Y)-(0≠100|Y)-0≠4|Y
81. Number of days in month X of years Y (for most leap years) X←I0; Y←I
(12⍴7⍴31 30)[X]-0⌈¯1+2⊥(X=2),[.1]0≠4|Y
82. Encoding current date
100⊥100|3↑⎕TS
83. Removing trailing blanks X←C1
(1-(' '=X)⊥1)↓X
84. Index of first non-blank, counted from the rear X←C1
(' '=X)⊥1
85. Indexing scattered elements X←A; Y←I2
(,X)[⎕IO+(⍴X)⊥Y-⎕IO]
86. Conversion of indices Y of array X to indices of raveled X X←A; Y←I2
⎕IO+(⍴X)⊥Y-⎕IO
87. Number of columns in array X as a scalar X←A
0⊥⍴X
88. Future value of cash flows X at interest rate Y % X←D1; Y←D0
(1+Y÷100)⊥X
89. Sum of the elements of vector X X←D1
1⊥X
90. Last element of numeric vector X as a scalar X←D1
0⊥X
91. Last row of matrix X as a vector X←A
0⊥X
92. Integer representation of logical vectors X←B
2⊥X
93. Value of polynomial with coefficients Y at point X X←D0; Y←D
X⊥Y

Encode

94. Conversion from decimal to hexadecimal (X=1..255) X←I
⍉'0123456789ABCDEF'[⎕IO+((⌈⌈/16⍟,X)⍴16)⊤X]
this alternative opens the range to 0..⌊/⍳0
⍉'0123456789ABCDEF'[⎕IO+((1+⌊16⍟⌈/X+X=0)⍴16)⊤X]
95. All binary representations up to X (truth table) X←I0
((⌈2⍟1+X)⍴2)⊤0,⍳X
96. Representation of X in base Y X←D0; Y←D0
((1+⌊Y⍟X)⍴Y)⊤X
97. Digits of X separately X←I0
((1+⌊10⍟X)⍴10)⊤X
98. Helps locating column positions 1..X X←I0
1 0⍕10 10⊤1-⎕IO-⍳X
99. Conversion of characters to hexadecimal representation (⎕AV) X←C1
,' ',⍉'0123456789ABCDEF'[⎕IO+16 16⊤-⎕IO-⎕AV⍳X]
100. Polynomial with roots X X←D1
⌽((0,⍳⍴X)∘.=+⌿~A)+.×(-X)×.*A←((⍴X)⍴2)⊤¯1+⍳2*⍴X
101. Index pairs of saddle points X←D2
⎕IO+(⍴X)⊤-⎕IO-(,(X=(⍴X)⍴⌈⌿X)∧X=⍉(⌽⍴X)⍴⌊/X)/⍳×/⍴X
102. Changing connectivity matrix X to a connectivity list X←C2
(,X)/1+A⊤¯1+⍳×/A←⍴X
103. Matrix of all indices of X X←A
⎕IO+(⍴X)⊤(⍳×/⍴X)-⎕IO
104. Separating a date YYMMDD to YY, MM, DD X←D
⍉(3⍴100)⊤X
105. Indices of elements Y in array X X←A; Y←A
⎕IO+(⍴X)⊤(-⎕IO)+(,X∊Y)/⍳⍴,X
106. All pairs of elements of ⍳X and ⍳Y X←I0; Y←I0
⎕IO+(X,Y)⊤(⍳X×Y)-⎕IO
107. Matrix for choosing all subsets of X (truth table) X←A1
((⍴X)⍴2)⊤¯1+⍳2*⍴X
108. All binary representations with X bits (truth table) X←I0
(X⍴2)⊤¯1+⍳2*X
109. Incrementing cyclic counter X with upper limit Y X←D; Y←D0
1+Y⊤X
110. Decoding numeric code ABBCCC into a matrix X←I
10 100 1000⊤X
111. Integer and fractional parts of positive numbers X←D
0 1⊤X

Logarithm

112. Number of decimals of elements of X X←D1
⌊10⍟(⍎('.'≠A)/A←⍕X)÷X
113. Number of sortable columns at a time using and alphabet X X←C1
⌊(1+⍴X)⍟2*(A=¯1+A←2*⍳128)⍳1
114. Playing order in a cup for X ranked players X←I0
,⍉(A⍴2)⍴(2*A←⌈2⍟X)↑⍳X
115. Arithmetic precision of the system (in decimals)
⌊|10⍟|1-3×÷3
116. Number of digitpositions in integers in X X←I
1+(X<0)+⌊10⍟|X+0=X
117. Number of digit positions in integers in X X←I
1+⌊10⍟(X=0)+X×(1 ¯10)[1+X<0]
118. Number of digits in positive integers in X X←I
1+⌊10⍟X+0=X

Branch

119. Case structure according to key vector G X←A0; Y←I1; G←A1
→Y[G⍳X]
120. Forming a transitive closure X←B2
→⎕LC⌈⍳∨/,(X←X∨X∨.∧X)≠+X
121. Case structure with integer switch X←I0; Y←I1
→X⌽Y
122. For-loop ending construct X←I0; Y←I0; G←I0
→Y⌈⍳G≥X←X+1
123. Conditional branch to line Y X←B0; Y←I0; Y>0
→Y⌈⍳X
124. Conditional branch out of program X←B0
→0⌊⍳X
125. Conditional branch depending on sign of X X←I0; Y←I1
→Y[2+×X]
126. Continuing from line Y (if X>0) or exit X←D0; Y←I0
→Y××X
127. Case structure using levels with limits G X←D0; G←D1; Y←I1
→(X≥G)/Y
128. Case structure with logical switch (preferring from start) X←B1; Y←I1
→X/Y
129. Conditional branch out of program X←B0
→0×⍳X

Execute

132. Test for symmetricity of matrix X X←A2
⍎⍎'1','↑↓'[⎕IO+∧/(⍴X)=⌽⍴X],'''0~0∊X=⍉X'''
133. Using a variable named according to X X←A0; Y←A
⍎'VAR',(⍕X),'←Y'
134. Rounding to ⎕PP precision X←D1
⍎⍕X
135. Convert character or numeric data into numeric X←A1
⍎⍕X
136. Reshaping only one-element numeric vector X into a scalar X←D1
⍎⍕X
137. Graph of F(X) at points X ('X'∊F) F←A1; X←D1
' *'[⎕IO+(⌽(¯1+⌊/A)+⍳1+(⌈/A)-⌊/A)∘.=A←⌊.5+⍎F]
138. Conversion of each row to a number (default zero) X←C2
(X∨.≠' ')\1↓⍎'0 ',,X,' '
139. Test for symmetricity of matrix X X←A2
⍎(¯7*A∧.=⌽A←⍴X)↑'0~0∊X=⍉X'
140. Execution of expression X with default value Y X←D1
⍎((X∧.=' ')/'Y'),X
141. Changing X if a new input value is given X←A
X←⍎,((2↑'X'),' ',[.5]A)[⎕IO+~' '∧.=A←⍞;]
142. Definite integral of F(X) in range Y with G steps ('X'∊F) F←A1; G←D0; Y←D1; ⍴Y ←→ 2
A+.×⍎F,0⍴X←Y[1]+(A←--/Y÷G)×0,⍳G
143. Test if numeric and conversion to numeric form X←C1
1↓⍎'0 ',(∧/X∊' 0123456789')/X
144. Tests the social security number (Finnish) Y←'01...9ABC...Z'; 10=⍴X
(¯1↑X)=((~Y∊'GIOQ')/Y)[1+31|⍎9↑X]
145. Conditional execution X←B0
⍎X/'EXPRESSION'
146. Conditional branch out of programs X←B0
⍎X/'→'
147. Using default value 100 if X does not exist X←A
⍎(¯3*2≠⎕NC 'X')↑'X100'
148. Conditional execution X←B0
⍎X↓'⍝ ...'
149. Giving a numeric default value for input X←D0
1⍴(⍎⍞,',⍳0'),X
150. Assign values of expressions in X to variables named in Y X←C2; Y←C2
A←⍎,',','(','0','⍴',Y,'←',X,')'
151. Evaluation of several expressions; results form a vector X←A
⍎,',','(',',',X,')'
152. Sum of numbers in character matrix X X←A2
⍎,'+',X
153. Indexing when rank is not known beforehand X←A; Y←I
⍎'X[',((¯1+⍴⍴X)⍴';'),'Y]'

Format

154. Numeric headers (elements of X) for rows of table Y X←D1; Y←A2
(3⌽7 0⍕X∘.+,0),⍕Y
155. Formatting a numerical vector to run down the page X←D1
⍕X∘.+,0
156. Representation of current date (ascending format)
A←⍕⌽3↑⎕TS ⋄ A[(' '=A)/⍳⍴A]←'.' ⋄ A
157. Representation of current date (American)
A←⍕100|1⌽3↑⎕TS ⋄ A[(' '=A)/⍳⍴A]←'/' ⋄ A
158. Formatting with zero values replaced with blanks X←A
(⍴A)⍴B\(B←,('0'≠A)∨' '≠¯1⌽A)/,A←' ',⍕X
159. Number of digit positions in scalar X (depends on ⎕PP) X←D0
⍴⍕X
160. Leading zeroes for X in fields of width Y X←I1; Y←I0; X≥0
0 1↓(2↑Y+1)⍕X∘.+,10*Y
161. Row-by-row formatting (width G) of X with Y decimals per row X←D2; Y←I1; G←I0
((1,G)×⍴X)⍴2 1 3⍉(⌽G,⍴X)⍴(,G,[1.1]Y)⍕⍉X
163. Formatting X with H decimals in fields of width G X←D; G←I1; H←I1
(,G,[1.1]H)⍕X

Roll / Deal ?

164. Y-shaped array of random numbers within ( X[1],X[2] ] X←I1; Y←I1
X[1]+?Y⍴--/X
165. Removing punctuation characters X←A1
(~X∊' .,:;?''')/X
166. Choosing Y objects out of ⍳X with replacement (roll) Y←I; X←I
?Y⍴X
167. Choosing Y objects out of ⍳X without replacement (deal) X←I0; Y←I0
Y?X

Geometrical Functions

168. Arctan Y÷X X←D; Y←D
((X≠0)ׯ3○Y÷X+X=0)+○((X=0)×.5××Y)+(X<0)×1-2×Y<0
169. Conversion from degrees to radians X←D
X×○÷180
170. Conversion from radians to degrees X←D
X×180÷○1
171. Rotation matrix for angle X (in radians) counter-clockwise X←D0
2 2⍴1 ¯1 1 1×2 1 1 2○X

Factorial / Binomial !

172. Number of permutations of X objects taken Y at a time X←D; Y←D
(!Y)×Y!X
173. Value of Taylor series with coefficients Y at point X X←D0; Y←D1
+/Y×(X*A)÷!A←¯1+⍳⍴Y
174. Poisson distribution of states X with average number Y X←I; Y←D0
(*-Y)×(Y*X)÷!X
175. Gamma function X←D0
!X-1
176. Binomial distribution of X trials with probability Y X←I0; Y←D0
(A!X)×(Y*A)×(1-Y)*X-A←-⎕IO-⍳X+1
177. Beta function X←D0; Y←D0
÷Y×(X-1)!Y+X-1
178. Selecting elements satisfying condition X, others to 1 X←B; Y←D
X!Y
179. Number of combinations of X objects taken Y at a time X←D; Y←D
Y!X

Index Of

180. Removing elements Y from beginning and end of vector X X←A1; Y←A
((A⍳1)-⎕IO)↓(⎕IO-(⌽A←~X∊Y)⍳1)↓X
181. Alphabetical comparison with alphabets G X←A; Y←A
(G⍳X)<G⍳Y
183. Sum over elements of X determined by elements of Y X←D1; Y←D1
X+.×Y∘.=((⍳⍴Y)=Y⍳Y)/Y
184. First occurrence of string X in string Y X←A1; Y←A1
(∧⌿(¯1+⍳⍴X)⌽X∘.=Y)⍳1
185. Removing duplicate rows X←A2
((A⍳A)=⍳⍴A←⎕IO++⌿∧⍀X∨.≠⍉X)⌿X
186. First occurrence of string X in matrix Y X←A1; Y←A2; ¯1↑⍴Y←→⍴X
(Y∧.=X)⍳1
187. Indices of ones in logical vector X X←B1
(+\X)⍳⍳+/X
188. Executing costly monadic function F on repetitive arguments X←A1
(F B/X)[+\B←(X⍳X)=⍳⍴X]
189. Index of (first) maximum element of X X←D1
X⍳⌈/X
190. Index of first occurrence of elements of Y X←C1; Y←C1
⌊/X⍳Y
191. Index of (first) minimum element of X X←D1
X⍳⌊/X
192. Test if each element of X occurs only once X←A1
∧/(X⍳X)=⍳⍴X
193. Test if all elements of vector X are equal X←A1
∧/⎕IO=X⍳X
194. Interpretation of roman numbers X←A
+/Aׯ1*A<1⌽A←0,(1000 500 100 50 10 5 1)['MDCLXVI'⍳X]
195. Removing elements Y from end of vector X X←A1; Y←A
(⎕IO-(~⌽X∊Y)⍳1)↓X
196. Removing trailing blanks X←C1
(1-(⌽' '≠X)⍳1)↓X
198. Index of last occurrence of Y in X (⎕IO-1 if not found) X←A1; Y←A
((¯1 1)[2×⎕IO]+⍴X)-(⌽X)⍳Y
199. Index of last occurrence of Y in X (0 if not found) X←A1; Y←A
(1+⍴X)-(⌽X)⍳Y
200. Index of last occurrence of Y in X, counted from the rear X←A1; Y←A
(⌽X)⍳Y
201. Index of first occurrence of G in X (circularly) after Y X←A1; Y←I0; G←A
⎕IO+(⍴X)|Y+(Y⌽X)⍳G
202. Alphabetizing X; equal alphabets in same column of Y Y←C2; X←C
(¯1↑⍴Y)|(,Y)⍳X
203. Changing index of an unfound element to zero Y←A1; X←A
(1+⍴Y)|Y⍳X
204. Replacing elements of G in set X with corresponding Y X←A1, Y←A1, G←A
A[B/⍳⍴B]←Y[(B←B≤⍴Y)/B←X⍳A←,G] ⋄ (⍴G)⍴A
205. Removing duplicate elements (nub) X←A1
((X⍳X)=⍳⍴X)/X
206. First word in X X←C1
(¯1+X⍳' ')↑X
207. Removing elements Y from beginning of vector X X←A1; Y←A
(((~X∊Y)⍳1)-⎕IO)↓X
208. Removing leading zeroes X←A1
(¯1+(X='0')⍳0)↓X
209. Index of first one after index Y in X G←I0; X←B1
Y+(Y↓X)⍳1
210. Changing index of an unfound element to zero (not effective) X←A; Y←A1
(X∊Y)×Y⍳X
211. Indicator of first occurrence of each unique element of X X←A1
(X⍳X)=⍳⍴X
212. Inverting a permutation X←I1
X⍳⍳⍴X
213. Index of first differing element in vectors X and Y X←A1; Y←A1
(Y≠X)⍳1
214. Which elements of X are not in set Y (difference of sets) X←A; Y←A1
(⎕IO+⍴Y)=Y⍳X
215. Changing numeric code X into corresponding name in Y X←D; Y←D1; G←C2
G[Y⍳X;]
216. Index of key Y in key vector X X←A1; Y←A
X⍳Y
217. Conversion from characters to numeric codes X←A
⎕AV⍳X
218. Index of first satisfied condition in X X←B1
X⍳1

Outer Product ∘.! ∘.⌈ ∘.|

219. Pascal's triangle of order X (binomial coefficients) X←I0
⍉A∘.!A←0,⍳X
220. Maximum table X←I0
(⍳X)∘.⌈⍳X
221. Number of decimals (up to Y) of elements of X X←D; Y←I0
0+.≠(⌈(10*Y)×10*⎕IO-⍳Y+1)∘.|⌈X×10*Y
222. Greatest common divisor of elements of X X←I1
⌈/(∧/0=A∘.|X)/A←⍳⌊/X
223. Divisibility table X←I1
0=(⍳⌈/X)∘.|X
224. All primes up to X X←I0
(2=+⌿0=(⍳X)∘.|⍳X)/⍳X

Outer Product ∘.* ∘.× ∘.- ∘.+

225. Compound interest for principals Y at rates G % in times X X←D; Y←D; G←D
Y∘.×(1+G÷100)∘.*X
226. Product of two polynomials with coefficients X and Y X←D1; Y←D1
+⌿(⎕IO-⍳⍴X)⌽X∘.×Y,0×1↓X
228. Shur product X←D2; Y←D2
1 2 1 2⍉X∘.×Y
229. Direct matrix product X←D2; Y←D2
1 3 2 4⍉X∘.×Y
230. Multiplication table X←I0
(⍳X)∘.×⍳X
231. Replicating a dimension of rank three array X Y-fold Y←I0; X←A3
X[;,(Y⍴1)∘.×⍳(⍴X)[2];]
232. Array and its negative ('plus minus') X←D
X∘.×1 ¯1
233. Move set of points X into first quadrant X←D2
1 2 1⍉X∘.-⌊/X
234. Test relations of elements of X to range Y; result in ¯2..2 X←D; Y←D; 2=¯1↑⍴Y
+/×X∘.-Y
235. Occurrences of string X in string Y X←A1; Y←A1
(Y[A∘.+¯1+⍳⍴X]∧.=X)/A←(A=1↑X)/⍳⍴A←(1-⍴X)↓Y
236. Sum of common parts of matrices (matrix sum) X←D2; Y←D2
1 2 1 2⍉X∘.+Y
237. Adding X to each row of Y X←D1; Y←D2
1 1 2⍉X∘.+Y
238. Adding X to each row of Y X←D1; Y←D2
1 2 1⍉Y∘.+X
240. Adding X to each column of Y X←D1; Y←D2
2 1 2⍉X∘.+Y
241. Adding X to each column of Y X←D1; Y←D2
1 2 2⍉Y∘.+X
242. Hilbert matrix of order X X←I0
÷¯1+(⍳X)∘.+⍳X
243. Moving index of width Y for vector X X←A1; Y←I0
(0,⍳(⍴X)-Y)∘.+Y
244. Indices of subvectors of length Y starting at X+1 X←I1; Y←I0
X∘.+⍳Y
245. Reshaping numeric vector X into a one-column matrix X←D1
X∘.+,0
246. Annuity coefficient: X periods at interest rate Y % X←I; Y←D
((⍴A)⍴Y÷100)÷A←⍉1-(1+Y÷100)∘.*-X

Outer Product ∘.< ∘.≤ ∘.≥ ∘.>

247. Matrix with X[i] trailing zeroes on row i X←I1
X∘.<⌽⍳⌈/X
248. Matrix with X[i] leading zeroes on row i X←I1
X∘.<⍳⌈/X
249. Distribution of X into intervals between Y X←D; Y←D1
+/((¯1↓Y)∘.≤X)∧(1↓Y)∘.>X
250. Histogram (distribution barchart; down the page) X←I1
' ⎕'[⎕IO+(⌽⍳⌈/A)∘.≤A←+/(⍳1+(⌈/X)-⌊/X)∘.=X]
251. Barchart of integer values (down the page) X←I1
' ⎕'[⎕IO+(⌽⍳⌈/X)∘.≤X]
252. Test if X is an upper triangular matrix X←D2
∧/,(0≠X)≤A∘.≤A←⍳1↑⍴X
253. Number of ?s intersecting ?s (X=starts, Y=stops) X←D1; Y←D1
+/A∧⍉A←X∘.≤Y
254. Contour levels Y at points with altitudes X X←D0; Y←D1
Y[+⌿Y∘.≤X]
255. X×X upper triangular matrix X←I0
(⍳X)∘.≤⍳X
256. Classification of elements Y into X classes of equal size X←I0; Y←D1
+/(A×X÷⌈/A←Y-⌊/Y)∘.≥¯1+⍳X
257. Matrix with X[i] trailing ones on row i X←I1
X∘.≥⌽⍳⌈/X
258. Comparison table X←I1
X∘.≥⍳⌈/X,0
259. Barchart of X with height Y (across the page) X←D1; Y←D0
' ⎕'[⎕IO+X∘.≥(⌈/X)×(⍳Y)÷Y]
260. Barchart of integer values (across the page) X←I1
' ⎕'[⎕IO+X∘.≥⍳⌈/X]
261. Matrix with X[i] leading ones on row i X←I1
X∘.≥⍳⌈/X
263. Test if X is a lower triangular matrix X←D2
∧/,(0≠X)≤A∘.≥A←⍳1↑⍴X
264. Test if X is within range [ Y[1],Y[2] ) X←D; Y←D1
≠/X∘.≥Y
265. Ordinal numbers of words in X that indices Y point to X←C1; Y←I
⎕IO++/Y∘.≥(' '=X)/⍳⍴X
266. Which class do elements of X belong to X←D
+/X∘.≥0 50 100 1000
267. X×X lower triangular matrix X←I0
(⍳X)∘.≥⍳X
268. Moving all blanks to end of each row X←C
(⍴X)⍴(,(+/A)∘.>-⎕IO-⍳¯1↑⍴X)\(,A←X≠' ')/,X
269. Justifying right fields of X (lengths Y) to length G X←A1; Y←I1; G←I0
(,Y∘.>⌽(⍳G)-⎕IO)\X
270. Justifying left fields of X (lengths Y) to length G X←A1; Y←I1; G←I0
(,Y∘.>(⍳G)-⎕IO)\X

Outer Product ∘.≠ ∘.=

271. Indices of elements of Y in corr. rows of X (X[i;]⍳Y[i;]) X←A2; Y←A2
1++/∧\1 2 1 3⍉Y∘.≠X
273. Indicating equal elements of X as a logical matrix X←A1
⍉X∘.=(1 1⍉<\X∘.=X)/X
275. Changing connection matrix X (¯1 → 1) to a node matrix X←I2
(1 ¯1∘.=⍉X)+.×⍳1↑⍴⎕←X
276. Sums according to codes G X←A; Y←D; G←A
(G∘.=X)+.×Y
277. Removing duplicate elements (nub) X←A1
(1 1⍉<\X∘.=X)/X
278. Changing node matrix X (starts,ends) to a connection matrix X←I2
-/(⍳⌈/,X)∘.=⍉X
279. Test if all elements of vector X are equal X←B1
∨/∧/0 1∘.=X
280. Test if elements of X belong to corr. row of Y (X[i;]∊Y[i;]) X←A2; Y←A2; 1↑⍴X←→1↑⍴Y
∨/1 2 1 3⍉X∘.=Y
281. Test if X is a permutation vector X←I1
∧/1=+⌿X∘.=⍳⍴X
282. Occurrences of string X in string Y X←C1; Y←C1
(∧⌿(¯1+⍳⍴X)⌽(X∘.=Y),0)/⍳1+⍴Y
283. Division to Y classes with width H, minimum G X←D; Y←I0; G←D0; H←D0
+/(⍳Y)∘.=⌈(X-G)÷H
285. Repeat matrix X←A1; Y←A1
(((¯1⌽~A)∧A←(¯1↓X=1⌽X),0)/Y)∘.=Y
286. X×X identity matrix X←I0
(⍳X)∘.=⍳X

Inner Product ⌈.× ⌊.× ⌊.+ ×.○ ×.* +.*

287. Maxima of elements of subsets of X specified by Y X←A1; Y←B
A+(X-A←⌊/X)⌈.×Y
288. Indices of last non-blanks in rows X←C
(' '≠X)⌈.×⍳¯1↑⍴X
289. Maximum of X with weights Y X←D1; Y←D1
Y⌈.×X
290. Minimum of X with weights Y X←D1; Y←D1
Y⌊.×X
292. Extending a distance table to next leg X←D2
X←X⌊.+X
293. A way to combine trigonometric functions (sin X cos Y) X←D0; Y←D0
1 2×.○X,Y
294. Sine of a complex number X←D; 2=1↑⍴X
(2 2⍴1 6 2 5)×.○X
295. Products over subsets of X specified by Y X←A1; Y←B
X×.*Y
296. Sum of squares of X X←D1
X+.*2
297. Randomizing random numbers (in ⎕LX in a workspace)
⎕RL←⎕TS+.*2

Inner Product ∨.∧ <.< <.≤ <.≥ ≤.≥ >.>

298. Extending a transitive binary relation X←B2
X←X∨.∧X
299. Test if X is within range [ Y[1;],Y[2;] ) X←D0; Y←D2; 1↑⍴Y ←→ 2
X<.<Y
300. Test if X is within range ( Y[1;],Y[2;] ] X←D0; Y←D2; 1↑⍴Y ←→ 2
X<.≤Y
301. Test if X is within range ( Y[1;],Y[2;] ] X←D; Y←D2; 1↑⍴Y ←→ 2
X<.≤Y
302. Test if the elements of X are ascending X←D1
X<.≥1⌽X
303. Test if X is an integer within range [ G,H ) X←I0; G←I0; H←I0
~X≤.≥(⌈X),G,H
304. Test if X is within range ( Y[1;],Y[2;] ] X←D; Y←D2; 1↑⍴Y ←→ 2
(X,[.1+⍴⍴X]X)>.>Y

Inner Product ∨.≠ ∧.= +.≠ +.=

306. Removing trailing blank columns X←C2
(⌽∨\⌽' '∨.≠X)/X
307. Removing leading blank rows X←C2
(∨\X∨.≠' ')⌿X
308. Removing leading blank columns X←C2
(∨\' '∨.≠X)/X
309. Index of first occurrences of rows of X as rows of Y X←A, Y←A2
⎕IO++⌿∧⍀Y∨.≠⍉X
310. X⍳Y for rows of matrices X←A2; Y←A2
⎕IO++⌿∧⍀X∨.≠⍉Y
311. Removing duplicate blank rows X←C2
(A∨1↓1⌽1,A←X∨.≠' ')⌿X
312. Removing duplicate blank columns X←C2
(A∨1,¯1↓A←' '∨.≠X)/X
313. Removing blank columns X←C2
(' '∨.≠X)/X
314. Removing blank rows X←C2
(X∨.≠' ')⌿X
315. Test if rows of X contain elements differing from Y X←A; Y←A0
X∨.≠Y
316. Removing trailing blank rows X←C2
(-2↑+/∧\⌽X∧.=' ')↓X
317. Removing duplicate rows X←A2
(∨⌿<\X∧.=⍉X)⌿X
318. Removing duplicate rows X←A2
(1 1⍉<\X∧.=⍉X)⌿X
319. Test if circular lists are equal (excluding phase) X←A1; Y←A1
∨/Y∧.=⍉(⍳⍴X)⌽(2⍴⍴X)⍴X
320. Test if all elements of vector X are equal X←B1
X∧.=∨/X
321. Test if all elements of vector X are equal X←B1
X∧.=∧/X
322. Rows of matrix X starting with string Y X←A2; Y←A1
((((1↑⍴X),⍴Y)↑X)∧.=Y)⌿X
323. Occurrences of string X in string Y X←A1; Y←A1
((-A)↓X∧.=(A,1+⍴Y)⍴Y)/⍳(⍴Y)+1-A←⍴X
324. Test if vector Y is a row of array X X←A; Y←A1
1∊X∧.=Y
325. Comparing vector Y with rows of array X X←A; Y←A1
X∧.=Y
326. Word lengths of words in list X X←C
X+.≠' '
327. Number of occurrences of scalar X in array Y X←A0; Y←A
X+.=,Y
328. Counting pairwise matches (equal elements) in two vectors X←A1; Y←A1
X+.=Y

Inner Product -.÷ +.÷ +.×

329. Sum of alternating reciprocal series Y÷X X←D1; Y←D1
Y-.÷X
330. Limits X to fit in field Y[1 2] X←D; Y←I1
(X⌈1↓A)⌊1↑A←(2 2⍴¯1 1 1 ¯.1)+.×10*(-1↓Y),-/Y+Y>99 0
331. Value of polynomial with coefficients Y at point X X←D0; Y←D
(X*¯1+⍳⍴Y)+.×⌽Y
332. Arithmetic average (mean value) of X weighted by Y X←D1; Y←D1
(Y+.×X)÷⍴X
333. Scalar (dot) product of vectors X←D1; Y←D1
Y+.×X
334. Sum of squares of X X←D1
X+.×X
335. Summation over subsets of X specified by Y X←A1; Y←B
X+.×Y
336. Matrix product X←D; Y←D; ¯1↑⍴X ←→ 1↑⍴Y
X+.×Y
337. Sum of reciprocal series Y÷X X←D1; Y←D1
Y+.÷X

Scan ⌈\ ⌊\ ×\ -\

338. Groups of ones in Y pointed to by X (or trailing parts) X←B; Y←B
Y∧A=⌈\X×A←+\Y>¯1↓0,Y
339. Test if X is in ascending order along direction Y X←D; Y←I0
∧/[Y]X=⌈\[Y]X
340. Duplicating element of X belonging to Y,1↑X until next found X←A1; Y←B1
X[1⌈⌈\Y×⍳⍴Y]
341. Test if X is in descending order along direction Y X←D; Y←I0
∧/[Y]X=⌊\[Y]X
342. Value of Taylor series with coefficients Y at point X X←D0; Y←D1
+/Y××\1,X÷⍳¯1+⍴Y
343. Alternating series (1 ¯1 2 ¯2 3 ¯3 ...) X←I0
-\⍳X

Scan ⍲\ <\ ≤\ ≠\

346. Value of saddle point X←D2
(<\,(X=(⍴X)⍴⌈⌿X)∧X=⍉(⌽⍴X)⍴⌊/X)/,X
348. First one (turn off all ones after first one) X←B
<\X
350. Not first zero (turn on all zeroes after first zero) X←B
≤\X
351. Running parity (≠\) over subvectors of Y indicated by X X←B1; Y←B1
≠\Y≠X\A≠¯1↓0,A←X/≠\¯1↓0,Y
352. Vector (X[1]⍴1),(X[2]⍴0),(X[3]⍴1),... X←I1
≠\(⍳+/X)∊+\⎕IO,X
353. Not leading zeroes(∨\) in each subvector of Y indicated by X X←B1; Y←B1
≠\(Y∨X)\A≠¯1↓0,A←(Y∨X)/Y
354. Leading ones (∧\) in each subvector of Y indicated by X X←B1; Y←B1
~≠\(Y≤X)\A≠¯1↓0,A←~(Y≤X)/Y
355. Locations of texts between and including quotes X←C1
A∨¯1↓0,A←≠\X=''''
356. Locations of texts between quotes X←C1
A∧¯1↓0,A←≠\X=''''
357. Joining pairs of ones X←B
X∨≠\X
358. Places between pairs of ones X←B
(~X)∧≠\X
359. Running parity X←B
≠\X

Scan ∨\ ∧\

360. Removing leading and trailing blanks X←C1
((⌽∨\⌽A)∧∨\A←' '≠X)/X
361. First group of ones X←B
X∧∧\X=∨\X
362. Removing trailing blank columns X←C2
(⌽∨\⌽∨⌿' '≠X)/X
363. Removing trailing blanks X←C1
(⌽∨\⌽' '≠X)/X
364. Removing leading blanks X←C1
(∨\' '≠X)/X
365. Not leading zeroes (turn on all zeroes after first one) X←B
∨\X
366. Centering character array X with ragged edges X←C
(A-⌊0.5×(A←+/∧\⌽A)++/∧\A←' '=⌽X)⌽X
367. Decommenting a matrix representation of a function (⎕CR) X←C2
(∨/A)⌿(⍴X)⍴(,A)\(,A←∧\('⍝'≠X)∨≠\X='''')/,X
369. Centering character array X with only right edge ragged X←C
(-⌊0.5×+/∧\' '=⌽X)⌽X
370. Justifying right X←C
(-+/∧\⌽' '=X)⌽X
371. Removing trailing blanks X←C1
(-+/∧\⌽' '=X)↓X
372. Justifying left X←C
(+/∧\' '=X)⌽X
373. Editing X with Y '-wise X←C1; Y←C1
((~(⍴A↑X)↑'/'=Y)/A↑X),(1↓A↓Y),(A←+/∧\Y≠',')↓X
374. Removing leading blanks X←C1
(+/∧\' '=X)↓X
375. Indices of first blanks in rows of array X X←C
⎕IO++/∧\' '≠X
377. Leading ones (turn off all ones after first zero) X←B
∧\X

Scan +\

378. Vector (X[1]⍴1),(Y[1]⍴0),(X[2]⍴1),... X←I1; Y←I1
(⍳+/X,Y)∊+\1+¯1↓0,((⍳+/X)∊+\X)\Y
379. Replicate Y[i] X[i] times (for all i) X←I1; Y←A1
((X≠0)/Y)[+\¯1⌽(⍳+/X)∊+\X]
380. Vector (Y[1]+⍳X[1]),(Y[2]+⍳X[2]),(Y[3]+⍳X[3]),... X←I1; Y←I1; ⍴X←→⍴Y
⎕IO++\1+((⍳+/X)∊+\⎕IO,X)\Y-¯1↓1,X+Y
381. Replicate Y[i] X[i] times (for all i) X←I1; Y←A1
Y[+\(⍳+/X)∊¯1↓1++\0,X]
382. Replicate Y[i] X[i] times (for all i) X←I1; Y←A1
Y[⎕IO++\(⍳+/X)∊⎕IO++\X]
383. Cumulative sums (+\) over subvectors of Y indicated by X X←B1; Y←D1
+\Y-X\A-¯1↓0,A←X/+\¯1↓0,Y
384. Sums over (+/) subvectors of Y, lengths in X X←I1; Y←D1
A-¯1↓0,A←(+\Y)[+\X]
386. X first figurate numbers X←I0
+\+\⍳X
387. Insert vector for X[i] zeroes after i:th subvector X←I1; Y←B1
(⍳(⍴Y)++/X)∊+\1+¯1↓0,(1⌽Y)\X
388. Open a gap of X[i] after Y[G[i]] (for all i) X←I1; Y←A1; G←I1
((⍳(⍴Y)++/X)∊+\1+¯1↓0,((⍳⍴Y)∊G)\X)\Y
389. Open a gap of X[i] before Y[G[i]] (for all i) X←I1; Y←A1; G←I1
((⍳(⍴Y)++/X)∊+\1+((⍳⍴Y)∊G)\X)\Y
390. Changing lengths X of subvectors to starting indicators X←I1
A←(+/X)⍴0 ⋄ A[+\¯1↓⎕IO,X]←1 ⋄ A
391. Changing lengths X of subvectors to ending indicators X←I1
(⍳+/X)∊(+\X)-~⎕IO
392. Changing lengths X of subvectors to starting indicators X←I1
(⍳+/X)∊+\⎕IO,X
393. Insert vector for X[i] elements before i:th element X←I1
(⍳+/A)∊+\A←1+X
394. Sums over (+/) subvectors of Y indicated by X X←B1; Y←D1
A-¯1↓0,A←(1⌽X)/+\Y
395. Fifo stock Y decremented with X units Y←D1; X←D0
G-¯1↓0,G←0⌈(+\Y)-X
396. Locations of texts between and including quotes X←C1
A∨¯1↓0,A←2|+\X=''''
397. Locations of texts between quotes X←C1
A∧¯1↓0,A←2|+\X=''''
398. X:th subvector of Y (subvectors separated by Y[1]) Y←A1; X←I0
1↓(X=+\Y=1↑Y)/Y
399. Locating field number Y starting with first element of X Y←I0; X←C1
(Y=+\X=1↑X)/X
400. Sum elements of X marked by succeeding identicals in Y X←D1; Y←D1
A-¯1↓0,A←(Y≠1↓Y,0)/+\X
401. Groups of ones in Y pointed to by X X←B1; Y←B1
Y∧A∊(X∧Y)/A←+\Y>¯1↓0,Y
402. ith starting indicators X X←B1; Y←B1
(+\X)∊Y/⍳⍴Y
403. G:th subvector of Y (subvectors indicated by X) X←B1; Y←A1; G←I0
(G=+\X)/Y
404. Running sum of Y consecutive elements of X X←D1; Y←I0
((Y-1)↓A)-0,(-Y)↓A←+\X
405. Depth of parentheses X←C1
+\('('=X)-¯1↓0,')'=X
406. Starting positions of subvectors having lengths X X←I1
+\¯1↓⎕IO,X
407. Changing lengths X of subvectors of Y to ending indicators X←I1
(⍳⍴Y)∊(+\X)-~⎕IO
408. Changing lengths X of subvectors of Y to starting indicators X←I1
(⍳⍴Y)∊+\⎕IO,X
409. X first triangular numbers X←I0
+\⍳X
410. Cumulative sum X←D
+\X

Reduction ○/ ÷/ -/ ×/

411. Complementary angle (arccos sin X) X←D0
○/¯2 1,X
412. Evaluating a two-row determinant X←D2
-/×/0 1⊖X
413. Evaluating a two-row determinant X←D2
-/×⌿0 1⌽X
414. Area of triangle with side lengths in X (Heron's formula) X←D1; 3 ←→ ⍴X
(×/(+/X÷2)-0,X)*.5
415. Juxtapositioning planes of rank 3 array X X←A3
(×⌿2 2⍴1,⍴X)⍴2 1 3⍉X
416. Number of rows in array X (also of a vector) X←A
×/¯1↓⍴X
417. (Real) solution of quadratic equation with coefficients X X←D1; 3 ←→ ⍴X
(-X[2]-¯1 1×((X[2]*2)-×/4,X[1 3])*.5)÷2×X[1]
418. Reshaping planes of rank 3 array to rows of a matrix X←A3
(×/2 2⍴1,⍴X)⍴X
419. Reshaping planes of rank 3 array to a matrix X←A3
(×/2 2⍴(⍴X),1)⍴X
420. Number of elements (also of a scalar) X←A
×/⍴X
421. Product of elements of X X←D1
×/X
422. Alternating product X←D
÷/X
423. Centering text line X into a field of width Y X←C1; Y←I0
Y↑((⌊-/.5×Y,⍴X)⍴' '),X
424. Alternating sum X←D
-/X

Reduction ⌈/ ⌊/

425. Test if all elements of vector X are equal X←D1
(⌈/X)=⌊/X
426. Size of range of elements of X X←D1
(⌈/X)-⌊/X
427. Conversion of set of positive integers X to a mask X←I1
(⍳⌈/X)∊X
428. Negative infinity; the smallest representable value
⌈/⍳0
429. Vectors as column matrices in catenation beneath each other X←A1/2; Y←A1/2
X,[1+.5×⌈/(⍴⍴X),⍴⍴Y]Y
430. Vectors as row matrices in catenation upon each other X←A1/2; Y←A1/2
X,[.5×⌈/(⍴⍴X),⍴⍴Y]Y
431. Quick membership () for positive integers X←I1; Y←I1
A←(⌈/X,Y)⍴0 ⋄ A[Y]←1 ⋄ A[X]
432. Positive maximum, at least zero (also for empty X) X←D1
⌈/X,0
433. Maximum of elements of X X←D1
⌈/X
434. Positive infinity; the largest representable value
⌊/⍳0
435. Minimum of elements of X X←D1
⌊/X

Reduction ∨/ ⍲/ ≠/

436. Test if all elements of vector X are equal X←B1
⍲/0 1∊X
437. Test if all elements of vector X are equal X←B1
(∧/X)∨~∨/X
438. Test if all elements of vector X are equal X←B1
(∧/X)=∨/X
439. Test if all elements of vector X are equal X←B1
∧/X÷∨/X
440. Removing duplicate rows from ordered matrix X X←A2
(¯1⌽1↓(∨/X≠¯1⊖X),1)⌿X
441. Vector having as many ones as X has rows X←A2
∨/0/X
442. Test if X and Y have elements in common X←A; Y←A1
∨/Y∊X
443. None, neither X←B
~∨/X
444. Any, anyone X←B
∨/X
445. Test if all elements of vector X are equal X←B1
≠/0 1∊X
446. Parity X←B
≠/X

Reduction ∧/

447. Number of areas intersecting areas in X X←D3 (n × 2 × dim)
+/A∧⍉A←∧/X[;A⍴1;]≤2 1 3⍉X[;(A←1↑⍴X)⍴2;]
448. Test if all elements of vector X are equal X←B1
∧/X/1⌽X
449. Comparison of successive rows X←A2
∧/X=1⊖X
450. Test if all elements of vector X are equal X←A1
∧/X=1⌽X
451. Test if X is a valid APL name X←C1
∧/((1↑X)∊10↓A),X∊A←'0..9A..Za..z'
452. Test if all elements of vector X are equal X←A1
∧/X=1↑X
453. Identity of two sets X←A1; Y←A1
∧/(X∊Y),Y∊X
454. Test if X is a permutation vector X←I1
∧/(⍳⍴X)∊X
455. Test if all elements of vector X are equal X←B1
~∧/X∊~X
456. Test if X is boolean X←A
∧/,X∊0 1
457. Test if Y is a subset of X (Y ⊂ X) X←A; Y←A1
∧/Y∊X
458. Test if arrays of equal shape are identical X←A; Y←A; ⍴X ←→ ⍴Y
∧/,X=Y
459. Test if all elements of vector X are equal X←A1
∧/X=X[1]
460. Blank rows X←C2
∧/' '=X
461. All, both X←B
∧/X

Reduction +/

462. Standard deviation of X X←D1
((+/(X-(+/X)÷⍴X)*2)÷⍴X)*.5
463. Y:th moment of X X←D1
(+/(X-(+/X)÷⍴X)*Y)÷⍴X
464. Variance (dispersion) of X X←D1
(+/(X-(+/X)÷⍴X)*2)÷⍴X
465. Arithmetic average (mean value), also for an empty array X←D
(+/,X)÷1⌈⍴,X
466. Test if all elements of vector X are equal X←B1
0=(⍴X)|+/X
467. Average (mean value) of columns of matrix X X←D2
(+⌿X)÷1↑(⍴X),1
468. Average (mean value) of rows of matrix X X←D2
(+/X)÷¯1↑1,⍴X
469. Number of occurrences of scalar X in array Y X←A0; Y←A
+/X=,Y
470. Average (mean value) of elements of X along direction Y X←D; Y←I0
(+/[Y]X)÷(⍴X)[Y]
471. Arithmetic average (mean value) X←D1
(+/X)÷⍴X
472. Resistance of parallel resistors X←D1
÷+/÷X
473. Sum of elements of X X←D1
+/X
474. Row sum of a matrix X←D2
+/X
475. Column sum of a matrix X←D2
+⌿X
476. Reshaping one-element vector X into a scalar X←A1
+/X
477. Number of elements satisfying condition X X←B1
+/X

Reverse

478. Scan from end with function X←A
⌽⍺\⌽X
479. The index of positive integers in Y X←I; Y←I1
A←9999⍴⎕IO+⍴Y ⋄ A[⌽Y]←⌽⍳⍴Y ⋄ A[X]
480. 'Transpose' of matrix X with column fields of width Y X←A2; G←I0
((⌽A)×1,Y)⍴2 1 3⍉(1⌽Y,A←(⍴X)÷1,Y)⍴X
482. Adding X to each column of Y X←D1; Y←D; (⍴X)=1↑⍴Y
Y+⍉(⌽⍴Y)⍴X
483. Matrix with shape of Y and X as its columns X←A1; Y←A2
⍉(⌽⍴Y)⍴X
484. Derivate of polynomial X X←D1
¯1↓X×⌽¯1+⍳⍴X
485. Reverse vector X on condition Y X←A1; Y←B0
,⌽[⎕IO+Y](1,⍴X)⍴X
486. Reshaping vector X into a one-column matrix X←A1
(⌽1,⍴X)⍴X
487. Avoiding parentheses with help of reversal
(⌽1, ...)

Rotate

488. Vector (cross) product of vectors X←D; Y←D
((1⌽X)ׯ1⌽Y)-(¯1⌽X)×1⌽Y
489. A magic square, side X X←I0; 1=2|X
A⊖(A←(⍳X)-⌈X÷2)⌽(X,X)⍴⍳X×X
490. Removing duplicates from an ordered vector X←A1
(¯1⌽1↓(X≠¯1⌽X),1)/X
491. An expression giving itself
1⌽22⍴11⍴'''1⌽22⍴11⍴'''
492. Transpose matrix X on condition Y X←A2; Y←B0
(Y⌽1 2)⍉X
493. Any element true (∨/) on each subvector of Y indicated by X X←B1; Y←B1
(X/Y)≥A/1⌽A←(Y∨X)/X
494. All elements true (∧/) on each subvector of Y indicated by X X←B1; Y←B1
(X/Y)∧A/1⌽A←(Y≤X)/X
495. Removing leading, multiple and trailing Y's X←A1; Y←A0
(1↑A)↓(A⍲1⌽A←Y=X)/X
496. Changing starting indicators X of subvectors to lengths X←B1
A-¯1↓0,A←(1⌽X)/⍳⍴X
498. (Cyclic) compression of successive blanks X←C1
(A∨1⌽A←X≠' ')/X
499. Aligning columns of matrix X to diagonals X←A2
(1-⍳¯1↑⍴X)⌽X
500. Aligning diagonals of matrix X to columns X←A2
(¯1+⍳¯1↑⍴X)⌽X
501. Diagonal matrix with elements of X X←D1
0 ¯1↓(-⍳⍴X)⌽((2⍴⍴X)⍴0),X
502. Test if elements differ from previous ones (non-empty X) X←A1
1,1↓X≠¯1⌽X
503. Test if elements differ from next ones (non-empty X) X←A1
(¯1↓X≠1⌽X),1
504. Replacing first element of X with Y X←A1; Y←A0
¯1⌽1↓X,Y
505. Replacing last element of X with Y X←A1; Y←A0
1⌽¯1↓Y,X
506. Ending points for X in indices pointed by Y X←A1; Y←I1
1⌽(⍳⍴X)∊Y
507. Leftmost neighboring elements cyclically X←A
¯1⌽X
508. Rightmost neighboring elements cyclically X←A
1⌽X

Transpose

509. Applying to columns action defined on rows X←A1; Y←I0
⍉ ... ⍉X
510. Retrieving scattered elements Y from matrix X X←A2; Y←I2
1 1⍉X[Y[1;];Y[2;]]
511. Successive transposes of G (X after Y: X⍉Y⍉G) X←I1; Y←I1
X[Y]⍉G
512. Major diagonal of array X X←A
(1*⍴X)⍉X
513. Reshaping a 400×12 character matrix to fit into one page X←C2
40 120⍴2 1 3⍉10 40 12⍴X
514. Transpose of planes of a rank three array X←A3
1 3 2⍉X
515. Major diagonal of matrix X X←A2
1 1⍉X
516. Selecting specific elements from a 'large' outer product X←A; Y←A; G←I1
G⍉X∘.⍺Y
517. Test for antisymmetricity of square matrix X X←D2
~0∊X=-⍉X
518. Test for symmetricity of square matrix X X←A2
~0∊X=⍉X
519. Matrix with X columns Y X←I0; Y←D1
⍉(X,⍴Y)⍴Y

Maximum Minimum

520. Limiting X between Y[1] and Y[2], inclusive X←D; Y←D1
Y[1]⌈Y[2]⌊X
521. Inserting vector Y to the end of matrix X X←A2; Y←A1
(A↑X),[⍳1](1↓A←(⍴X)⌈0,⍴Y)↑Y
522. Widening matrix X to be compatible with Y X←A2; Y←A2
((0 1×⍴Y)⌈⍴X)↑X
523. Lengthening matrix X to be compatible with Y X←A2; Y←A2
((1 0×⍴Y)⌈⍴X)↑X
524. Reshaping non-empty lower-rank array X into a matrix X←A; 2≥⍴⍴X
(1⌈¯2↑⍴X)⍴X
525. Take of at most X elements from Y X←I; Y←A
(X⌊⍴Y)↑Y
526. Limiting indices and giving a default value G X←A1; Y←I; G←A0
(X,G)[(1+⍴X)⌊Y]

Ceiling Floor

527. Reshaping X into a matrix of width Y X←D, Y←I0
((⌈(⍴,X)÷Y),Y)⍴X
528. Rounding to nearest even integer X←D
⌊X+1≤2|X
529. Rounding, to nearest even integer for .5 = 1||X X←D
⌊X+.5×.5≠2|X
530. Rounding, to nearest even integer for .5 = 1||X X←D
⌊X+.5×.5≠2|X
531. Arithmetic progression from X to Y with step G X←D0; Y←D0; G←D0
X+(G××Y-X)×(⍳1+|⌊(Y-X)÷G)-⎕IO
532. Centering text line X into a field of width Y X←C1; Y←I0
(-⌊.5×Y+⍴X)↑X
533. Test if integer X←D
X=⌊X
534. Rounding currencies to nearest 5 subunits X←D
.05×⌊.5+X÷.05
535. First part of numeric code ABBB X←I
⌊X÷1000
536. Rounding to X decimals X←I; Y←D
(10*-X)×⌊0.5+Y×10*X
537. Rounding to nearest hundredth X←D
0.01×⌊0.5+100×X
538. Rounding to nearest integer X←D
⌊0.5+X
539. Demote floating point representations to integers X←I
⌊X

Residue |

540. Test if X is a leap year X←I
(0=400|X)∨(0≠100|X)∧0=4|X
541. Framing X←C2
'_',[1]('|',X,'|'),[1]'¯'
542. Magnitude of fractional part X←D
1||X
543. Fractional part with sign X←D
(×X)|X
544. Increasing the dimension of X to multiple of Y X←A1; Y←I0
X,(Y|-⍴X)↑0/X
545. Removing every Y:th element of X X←A1; Y←I0
(0≠Y|⍳⍴X)/X
546. Taking every Y:th element of X X←A1; Y←I0
(0=Y|⍳⍴X)/X
547. Divisors of X X←I0
(0=A|X)/A←⍳X
548. Removing every second element of X X←A1
(2|⍳⍴X)/X
549. Elements of X divisible by Y X←D1; Y←D0/1
(0=Y|X)/X
550. Ravel of a matrix to Y[1] columns with a gap of Y[2] X←A2; Y←I1
(A×Y[1]*¯1 1)⍴(A←(⍴X)+(Y[1]|-1↑⍴X),Y[2])↑X
551. Test if even X←I
~2|X
552. Last part of numeric code ABBB X←I
1000|X
553. Fractional part X←D
1|X

Magnitude |, Signum ×

554. Increasing absolute value without change of sign X←D; Y←D
(×X)×Y+|X
555. Rounding to zero values of X close to zero X←D; Y←D
X×Y≤|X
556. Square of elements of X without change of sign X←D
X×|X
557. Choosing according to signum X←D; Y←A1
Y[2+×X]

Expand \

558. Not first zero (≤\) in each subvector of Y indicated by X X←B1; Y←B1
~(B∧X)∨(B∨X)\A>¯1↓0,A←(B∨X)/B←~Y
559. First one (<\) in each subvector of Y indicated by X X←B1; Y←B1
(Y∧X)∨(Y∨X)\A>¯1↓0,A←(Y∨X)/Y
560. Replacing elements of X in set Y with blanks/zeroes X←A0; Y←A1
A\(A←~X∊Y)/X
561. Replacing elements of X not in set Y with blanks/zeroes X←A1; Y←A
A\(A←X∊Y)/X
562. Merging X and Y under control of G (mesh) X←A1; Y←A1; G←B1
A←G\X ⋄ A[(~G)/⍳⍴G]←Y ⋄ A
563. Replacing elements of X not satisfying Y with blanks/zeroes X←A; Y←B1
Y\Y/X
564. Adding an empty row into X after rows Y X←A2; Y←I1
(~(⍳(⍴Y)+1⍴⍴X)∊Y+⍳⍴Y)⍀X
565. Test if numeric X←A1
0∊0\0⍴X
566. Adding an empty row into X after row Y X←A2; Y←I0
((Y+1)≠⍳1+1⍴⍴X)⍀X
567. Underlining words X←C1
X,[⎕IO-.1](' '≠X)\'¯'
568. Using boolean matrix Y in expanding X X←A1; Y←B2
(⍴Y)⍴(,Y)\X
569. Spacing out text X←C1
((2×⍴X)⍴1 0)\X

Compress /

570. Lengths of groups of ones in X X←B1
(A>0)/A←(1↓A)-1+¯1↓A←(~A)/⍳⍴A←0,X,0
571. Syllabization of a Finnish word X X←A1
(~A∊1,⍴X)/A←A/⍳⍴A←(1↓A,0)←~X∊'aeiouyÄÖ'
572. Choosing a string according to boolean value G X←C1; Y←C1; G←B0
(G/X),(~G)/Y
573. Removing leading, multiple and trailing blanks X←C1
(' '=1↑X)↓((1↓A,0)∨A←' '≠X)/X
575. Removing columns Y from array X X←A; Y←I1
(~(⍳¯1↑⍴X)∊Y)/X
576. Removing trailing blanks X←C1
(¯1↑(' '≠X)/⍳⍴X)⍴X
577. Lengths of subvectors of X having equal elements X←A1
(1↓A)-¯1↓A←(A,1)/⍳1+⍴A←1,(1↓X)≠¯1↓X
578. Field lengths of vector X; G ←→ ending indices X←A1; G←I1
G-¯1↓0,G←(~⎕IO)+(((1↓X)≠¯1↓X),1)/⍳⍴X
580. Removing multiple and trailing blanks X←C1
((1↓A,0)∨A←' '≠X)/X
581. Removing leading and multiple blanks X←C1
(A∨¯1↓0,A←' '≠X)/X
582. Removing multiple blanks X←C1
(A∨¯1↓1,A←' '≠X)/X
583. Removing duplicate Y's from vector X X←A1; Y←A0
(A∨¯1↓1,A←X≠Y)/X
584. Indices of all occurrences of elements of Y in X X←A1; Y←A
(X∊Y)/⍳⍴X
585. Union of sets, ? X←A1; Y←A1
Y,(~X∊Y)/X
586. Elements of X not in Y (difference of sets) X←A1; Y←A
(~X∊Y)/X
587. Rows of non-empty matrix X starting with a character in Y X←A2; Y←A1
(X[;1]∊Y)⌿X
588. Intersection of sets, ⍞ X←A1; Y←A
(X∊Y)/X
589. Reduction with function ⍺ in dimension Y, rank unchanged Y←I0; X←A
((⍴X)*Y≠⍳⍴⍴X)⍴ ⍺/[Y]X
590. Replacing all values X in G with Y X←A0; Y←A0; G←A
A[(A=X)/⍳⍴A←,G]←Y ⋄ (⍴G)⍴A
591. Indices of all occurrences of Y in X X←A1; Y←A0
(Y=X)/⍳⍴X
592. Replacing elements of G satisfying X with Y Y←A0; X←B1; G←A1
G[X/⍳⍴G]←Y
593. Removing duplicates from positive integers X←I1
A←9999⍴0 ⋄ A[X]←1 ⋄ A/⍳9999
594. Indices of ones in logical vector X X←B1
X/⍳⍴X
595. Conditional in text X←B0
((~X)/'IN'),'CORRECT'
596. Removing blanks X←A1
(' '≠X)/X
597. Removing elements Y from vector X X←A1; Y←A0
(X≠Y)/X
598. Vector to expand a new element after each one in X X←B1
(,X,[1.5]1)/,X,[1.5]~X
599. Reduction with FUNCTION without respect to shape X←D
⍺/,X
600. Reshaping scalar X into a one-element vector X←A
1/X
601. Empty matrix X←A2
0⌿X
602. Selecting elements of X satisfying condition Y X←A; Y←B1
Y/X

Take

603. Inserting vector X into matrix Y after row G X←A1; Y←A2; G←I0
Y[⍳G;],[1]((1↓⍴Y)↑X),[1](2↑G)↓Y
604. Filling X with last element of X to length Y X←A1; Y←I0
Y↑X,Y⍴¯1↑X
605. Input of row Y of text matrix X X←C2; Y←I0
X[Y;]←(1↑⍴X)↑⍞
606. First ones in groups of ones X←B
X>((-⍴⍴X)↑¯1)↓0,X
607. Inserting X into Y after index G X←A1; Y←A1; G←I0
(G↑Y),X,G↓Y
608. Pairwise differences of successive columns (inverse of +\) X←D
X-((-⍴⍴X)↑¯1)↓0,X
609. Leftmost neighboring elements X←D
((-⍴⍴X)↑¯1)↓0,X
610. Rightmost neighboring elements X←D
((-⍴⍴X)↑1)↓X,0
611. Shifting vector X right with Y without rotate X←A1; Y←I0
(-⍴X)↑(-Y)↓X
612. Shifting vector X left with Y without rotate X←A1; Y←I0
(⍴X)↑Y↓X
613. Drop of Y first rows from matrix X X←A2; Y←I0
(2↑Y)↓X
614. Test if numeric X←A
0∊1↑0⍴X
615. Reshaping non-empty lower-rank array X into a matrix X←A; 2≥⍴⍴X
(¯2↑1 1,⍴X)⍴X
616. Giving a character default value for input X←C0
1↑⍞,X
617. Adding scalar Y to last element of X X←D; Y←D0
X+(-⍴X)↑Y
618. Number of rows in matrix X X←A2
1↑⍴X
619. Number of columns in matrix X X←A2
¯1↑⍴X
620. Ending points for X fields of width Y X←I0; Y←I0
(X×Y)⍴(-Y)↑1
621. Starting points for X fields of width Y X←I0; Y←I0
(X×Y)⍴Y↑1
622. Zero or space depending on the type of X (fill element) X←A
1↑0⍴X
623. Forming first row of a matrix to be expanded X←A1
1 80⍴80↑X
624. Vector of length Y with X ones on the left, the rest zeroes X←I0; Y←I0
Y↑X⍴1
625. Justifying text X to right edge of field of width Y Y←I0; X←C1
(-Y)↑X

Drop

627. Starting points of groups of equal elements (non-empty X) X←A1
1,(1↓X)≠¯1↓X
628. Ending points of groups of equal elements (non-empty X) X←A1
((1↓X)≠¯1↓X),1
629. Pairwise ratios of successive elements of vector X X←D1
(1↓X)÷¯1↓X
630. Pairwise differences of successive elements of vector X X←D1
(1↓X)-¯1↓X
631. Differences of successive elements of X along direction Y X←D; Y←I0
X-(-Y=⍳⍴⍴X)↓0,[Y]X
632. Ascending series of integers Y..X (for small Y and X) X←I0; Y←I0
(Y-1)↓⍳X
633. First ones in groups of ones X←B1
X>¯1↓0,X
634. Last ones in groups of ones X←B1
X>1↓X,0
635. List of names in X (one per row) X←C2
1↓,',',X
636. Selection of X or Y depending on condition G X←A0; Y←A0; G←B0
''⍴G↓X,Y
637. Restoring argument of cumulative sum (inverse of +\) X←D1
X-¯1↓0,X
638. Drop of Y first rows from matrix X X←A2; Y←I0
(Y,0)↓X
639. Drop of Y first columns from matrix X X←A2; Y←I0
(0,Y)↓X
640. Number of rows in matrix X X←A2
¯1↓⍴X
641. Number of columns in matrix X X←A2
1↓⍴X
642. Conditional drop of Y elements from array X X←A; Y←I1; G←B1
(Y×G)↓X
643. Conditional drop of last element of X X←A1; Y←B0
(-Y)↓X

Member Of

644. Expansion vector with zero after indices Y X←A1; Y←I1
~(⍳(⍴Y)+⍴X)∊Y+⍳⍴Y
645. Boolean vector of length Y with zeroes in locations X X←I; Y←I0
(~(⍳Y)∊X)
646. Starting points for X in indices pointed by Y X←A1; Y←I1
(⍳⍴X)∊Y
647. Boolean vector of length Y with ones in locations X X←I; Y←I0
(⍳Y)∊X
648. Check for input in range 1..X X←A
(Y←⎕)∊⍳X
649. Test if arrays are identical X←A; Y←A
~0∊X=Y
650. Zeroing elements of Y depending on their values Y←D; X←D
Y×~Y∊X
651. Test if single or scalar X←A
1∊⍴,X
652. Test if vector X←A
1∊⍴⍴X
653. Test if X is an empty array X←A
0∊⍴X

Index Generator

654. Inverting a permutation X←I1
A←⍳⍴X ⋄ A[X]←A ⋄ A
655. All axes of array X X←A
⍳⍴⍴X
656. All indices of vector X X←A1
⍳⍴X
657. Arithmetic progression of Y numbers from X with step G X←D0; Y←D0; G←D0
X+G×(⍳Y)-⎕IO
658. Consecutive integers from X to Y (arithmetic progression) X←I0; Y←I0
(X-⎕IO)+⍳1+Y-X
659. Empty numeric vector
⍳0
660. Index origin (⎕IO) as a vector
⍳1

Logical Functions ~

661. Demote non-boolean representations to booleans X←B
0∨X
662. Test if X is within range ( Y[1],Y[2] ) X←D; Y←D1
(Y[1]<X)∧X<Y[2]
663. Test if X is within range [ Y[1],Y[2] ] X←D; Y←D1; 2=⍴Y
(Y[1]≤X)∧(X≤Y[2])
664. Zeroing all boolean values X←B
0∧X
666. Selection of elements of X and Y depending on condition G X←D; Y←D; G←B
(X×G)+Y×~G
667. Changing an index origin dependent result to be as ⎕IO=1 X←I
(~⎕IO)+X
668. Conditional change of elements of Y to one according to X Y←D; X←B
Y*~X

Comparison <≤>

669. X implies Y X←B; Y←B
X≤Y
670. X but not Y X←B; Y←B
X>Y
671. Avoiding division by zero error (gets value zero) X←D; Y←D
(0≠X)×Y÷X+0=X
672. Exclusive or X←B; Y←B
X≠Y
673. Replacing zeroes with corresponding elements of Y X←D; Y←D
X+Y×X=0
674. Kronecker delta of X and Y (element of identity matrix) X←I; Y←I
Y=X

Ravel ,

675. Catenating Y elements G after every element of X X←A1; Y←I0; G←A
,X,((⍴X),Y)⍴G
676. Catenating Y elements G before every element of X X←A1; Y←I0; G←A0
,(((⍴X),Y)⍴G),X
677. Merging vectors X and Y alternately X←A1; Y←A1
,Y,[⎕IO+.5]X
678. Inserting Y after each element of X X←A1; Y←A0
,X,[1.1]Y
679. Spacing out text X←C1
,X,[1.1]' '
680. Reshaping X into a matrix of width Y X←D, Y←I0
(((⍴,X),1)×Y*¯1 1)⍴X
681. Temporary ravel of X for indexing with G X←A; Y←A; G←I
A←⍴X ⋄ X←,X ⋄ X[G]←Y ⋄ X←A⍴X
682. Temporary ravel of X for indexing with G X←A; Y←A; G←I
A←,X ⋄ A[G]←Y ⋄ X←(⍴X)⍴A
683. First column as a matrix X←A2
X[;,1]
684. Number of elements (also of a scalar) X←A
⍴,X

Catenate ,

685. Separating variable length lines X←A1; Y←A1
X,⎕TC[2],Y
686. X×X identity matrix X←I0
(X,X)⍴1,X⍴0
687. Array and its negative ('plus minus') X←D
X,[.5+⍴⍴X]-X
688. Underlining a string X←C1
X,[⎕IO-.1]'¯'
689. Forming a two-column matrix X←A1; Y←A1
X,[1.1]Y
690. Forming a two-row matrix X←A1; Y←A1
X,[.1]Y
691. Selection of X or Y depending on condition G X←A0; Y←A0; G←B0
(X,Y)[⎕IO+G]
692. Increasing rank of Y to rank of X X←A; Y←A
((((⍴⍴X)-⍴⍴Y)⍴1),⍴Y)⍴Y
693. Identity matrix of shape of matrix X X←D2
(⍴X)⍴1,0×X
694. Reshaping vector X into a two-column matrix X←A1
((0.5×⍴X),2)⍴X
696. Reshaping vector X into a one-row matrix X←A1
(1,⍴X)⍴X
697. Reshaping vector X into a one-column matrix X←A1
((⍴X),1)⍴X
698. Forming a Y-row matrix with all rows alike (X) X←A1; Y←I0
(Y,⍴X)⍴X
699. Handling array X temporarily as a vector X←A
(⍴X)⍴ ... ,X
700. Joining sentences X←A; Y←A1
Y,0⍴X
701. Entering from terminal data exceeding input (printing) width X←D
X←0 2 1 2 5 8 0 4 5,⎕

Indexing [ ]

702. Value of fixed-degree polynomial Y at points X Y←D1; X←D
Y[3]+X×Y[2]+X×Y[1]
703. Number of columns in array X X←A
(⍴X)[⍴⍴X]
704. Number of rows in matrix X X←A2
(⍴X)[1]
705. Number of columns in matrix X X←A2
(⍴X)[2]
706. Conditional elementwise change of sign Y←D; X←B
Y×(1 ¯1)[1+X]
707. Selection depending on index origin X←A1
X[2×⎕IO]
708. Indexing with boolean value X (plotting a curve) X←B
' *'[⎕IO+X]
709. Indexing independent of index origin X←A1; Y←I
X[⎕IO+Y]
710. Selection depending on index origin X←A1
X[1]
711. Zeroing a vector (without change of size) X←D1
X[]←0
712. First column as a vector X←A2
X[;1]

Shape

713. Rank of array X X←A
⍴⍴X
715. Duplicating vector X Y times X←A1; Y←I0
(Y×⍴X)⍴X
716. Adding X to each row of Y X←D1; Y←D; (⍴X)=¯1↑⍴Y
Y+(⍴Y)⍴X
717. Array with shape of Y and X as its rows X←A1; Y←A
(⍴Y)⍴X
718. Number of rows in matrix X X←A2
1⍴⍴X

Reshape

720. Forming an initially empty array to be expanded
0 80⍴0
721. Output of an empty line X←A
0⍴X←
722. Reshaping first element of X into a scalar X←A
''⍴X
723. Corner element of a (non-empty) array X←A
1⍴X

Arithmetic + - × ÷

724. Continued fraction
1+÷2+÷3+÷4+÷5+÷6+÷ ...
725. Force 0÷0 into DOMAIN ERROR in division X←D; Y←D
Y×÷X
726. Conditional elementwise change of sign X←D; Y←B; ⍴X ←→ ⍴Y
Xׯ1*Y
727. Zero array of shape and size of X X←D
0×X
728. Selecting elements satisfying condition Y, zeroing others X←D; Y←B
Y×X
729. Number and its negative ('plus minus') X←D0
1 ¯1×X
730. Changing an index origin dependent result to be as ⎕IO=0 X←I
-⎕IO-X
731. Changing an index origin dependent argument to act as ⎕IO=1 X←I
(⎕IO-1)+X
732. Output of assigned numeric value X←D
+X←
733. Changing an index origin dependent argument to act as ⎕IO=0 X←I
⎕IO+X
734. Selecting elements satisfying condition Y, others to one X←D; Y←B
X*Y

Miscellaneous

736. Setting a constant with hyphens
⎕LX←⍞
737. Output of assigned value X←A
⎕←X←
738. Syntax error to stop execution
*
888. Meaning of life
⍎⊖⍕⊃⊂|⌊-*+○⌈×÷!⌽⍉⌹~⍴⍋⍒,⍟?⍳0

Notes

  1. Note: it doesn't average the middle two elements as per median's definition. A more correct idiomatic expression is 0.5×+/X[(⍋X)[|⌈¯0.5 0.5×1+⍴X]]