Differences between revisions 3 and 4
Revision 3 as of 2007-03-11 13:24:51
Size: 747
Comment:
Revision 4 as of 2008-08-20 18:57:19
Size: 745
Editor: anonymous
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
[:Studio:] [[Studio]]

Studio

Fun With Functions

What you type in an APL session is indented with six spaces.

      ⎕←'Hello World!'
Hello World!

      ⍳5
1 2 3 4 5

      20+⍳5
21 22 23 24 25

      2 3 4 + 100 500 200
102 503 204

      2 3 4 × 100 500 200
200 1500 800

      (⍳3)∘.+⍳3 ⍝ addition table
2 3 4
3 4 5
4 5 6

      (⍳3)∘.×⍳3 ⍝ multiplication table
1 2 3
2 4 6
3 6 9

      ∘.×⍨⍳3 ⍝ reflex operator (Dyalog) uses right argument on left
1 2 3
2 4 6
3 6 9

      ∘.=⍨⍳3 ⍝ identity matrix
1 0 0
0 1 0
0 0 1

      im←∘.=⍨∘⍳ ⍝ define a function (Dyalog)

      im 5 ⍝ use it
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1

Studio/FunWithFunctions (last edited 2008-08-20 18:57:19 by anonymous)