Studio/SimpleExamples
In the following examples, the user’s entry is indented 6 spaces to distinguish it from the computer’s response.
q← 2 3 5 7 9 ⍝ define q
1 + 2 × q ⍝ 1 plus 2 times q
5 7 11 15 19
+/ q ⍝ sum q
26
×\ q ⍝ partial products of q
2 6 30 210 1890
p← 1 2 3 2 2 ⍝ define p
p[⍋p] ⍝ p in ascending order
1 2 2 2 3
q[⍋p] ⍝ q sorted according to p
2 3 7 9 5
p ÷ q ⍝ p divided by q
0.5 0.6666666667 0.6 0.2857142857 0.2222222222
APL Wiki