APL study session 3

Discussion of the third study group can go here! APL Overview

[ <<< session 2 | session 4 >>> ]

This is a wiki post - feel free to edit to add links from the lesson or other useful info.

Overview

  • Basic math operators (continued)
    • Divide sign: reciprocal (monadic); divided by (dyadic)
    • Times sign: direction; times
      • Magnitude and direction of complex numbers; the unit circle
    • Star: exponential; power
      • Compound interest and exponential functions
      • Limits
      • Euler’s identity
  • Precedence

Study session resources

A rough note may be used as a video timestamp

Video timeline - thank you @Daniel

00:00 Air purification discussion

05:16 Interesting projects with APL

10:38 Nice note on APL

12:47 What to cover today? How to assing numbers to variables?

] Boxing on -style=max to put box on your output data array

13:20 How to use left arrow to assing number to a variable?

16:37 a website for APL study group: apl-study - APL Study Group and how fastpages build website from jupyter notebook

24:41 tidy the reop a little

30:55 raw cell, collapsible headings and finish on precedence

33:15 how to define function in apl and remember precedence in giving parameters to functions

36:45 What if you have more than 2 parameters? Can you put one function into another? Can you add unicode to create your own function symbols? How to do destructuring assignment?

39:52 Array rank, how to create vectors and matricies

42:42 Jump to learn about string first. string as a character vector

45:30 Back to hro

51:12 squad and quad

56:01 Zide and rho

  • 1:00:40 Understanding a 3D tensor symbol in APL dyalog
  • 1:01:42 song of rho

1:02:58 iota

1:07:32 string and iota

1:10:51 What does mat ⍳ 5 6 do?

1:12:50 Array in APL can be any shape, a vector is Rank 1 array, a matrix is Rank 2 array, a scalar is Rank 0 array

3 Likes

At the end we discovered that we cannot use our index of to search for columns.

        ⎕ ← mat ← 3 2 ⍴ ⍳ 6 
1 2
3 4
5 6
        mat ⍳ 5 6
3

We found that we could search for 5 6 and it will tell us it’s the 3rd row.

I was curious so did some extra research to see how to do this based on a column and here’s what I came up with (new symbols). By using we can transpose a matrix and search for a column. Note, because precedence is right to left we must use parenthesis so the transpose is applied first!

       (⍉mat) ⍳ 2 4 6
2

But we could add an additional symbol to let precedence follow standard rules (and the parenthesis then no longer needed). The symbol allows us to take a function and switch the arguments so what was on the left goes on the right and vise versa. This means everything follows normal precedence rules!

        2 4 6 ⍳⍨ ⍉mat
2

is interesting in that it is a monadic function that takes only 1 argument (a function) and that argument goes to the left of it. Other monadic functions we have seen normally take the argument to the right of it. This makes sense because when working right to left, you want to get to the reversion first otherwise you would have to use parenthesis every time you use .

2 Likes

Speaking of concise help pages, I found this on GNU site, but it’s for APL2 , I’m not sure how relevant it is for Dyalog as I understand there might be some differences?

https://www.gnu.org/software/apl/Bits_and_Pieces/apl2_summary.htm

And regarding Tilde Diaeresis, I found this helpful from this youtube Talk.:

One cool thing I found is that you can do with assignment is save intermediate values in actual expressions and keep going.

For example z ← (x ← 3) + 3: x = 3, and z = 6 after running this. Or z ← (⎕ ← 3) + 3 if you want print print the 3 intermediate value out whenever that code is run.

This can be handy, particularly if you are experimenting and want to save intermediate values since you can just assign them into variable, or even to quad to print anything you want out in the expression without breaking it up.

00:00 Air purification discussion

05:16 Interesting projects with APL

10:38 Nice note on APL

12:47 What to cover today? How to assing numbers to variables?

] Boxing on -style=max to put box on your output data array

13:20 How to use left arrow to assing number to a variable?

16:37 a website for APL study group: apl-study - APL Study Group and how fastpages build website from jupyter notebook

24:41 tidy the reop a little

30:55 raw cell, collapsible headings and finish on precedence

33:15 how to define function in apl and remember precedence in giving parameters to functions

36:45 What if you have more than 2 parameters? Can you put one function into another? Can you add unicode to create your own function symbols? How to do destructuring assignment?

39:52 Array rank, how to create vectors and matricies

42:42 Jump to learn about string first. string as a character vector

45:30 Back to hro

51:12 squad and quad

56:01 Zide and rho
- 1:00:40 Understanding a 3D tensor symbol in APL dyalog
- 1:01:42 song of rho

1:02:58 iota

1:07:32 string and iota

1:10:51 What does mat ⍳ 5 6 do?

1:12:50 Array in APL can be any shape, a vector is Rank 1 array, a matrix is Rank 2 array, a scalar is Rank 0 array

1 Like

Out of curiosity, do people find search and advanced search of the forum is quite limited?

Also I wonder can we customize the search of github pages through fastpages using regex?

At [23:23] Jeremy was curious whether you can apply to have the APL kernel installed.

I had a browse around and it seems you don’t have to ask. Its possible to do it yourself: