APL & Array programming

This video was very fun to watch in the sense that you dont need even a display to interact with a computer! or in this case a REPL!

1 Like

The video descriptions on YouTube should include a link to that video’s forum thread.

3 Likes

Only Tuesday to Friday (Australia). Hope to see u tomorrow.

1 Like

Done!

Not every empty cell is equal. :dizzy_face:
So, make sure to activate ]Boxing on -style=max before coding. Reference: Shape Reshape - APL Course

image

2 Likes

My keyboard layouts, including ones that use right-side Alt as APL shifting key. This key, also known as AltGr, is particularly well-suited as APL key for those that use US or similar layouts, as the key has little or no usage.

2 Likes

I have a question, how are monadic and dyadic operations “defined” or chosed the way they are?

For example for +0j4 is different than the dyadic 0j4+0j4 but how some one said that monadic + is congujate?

I mean for - is pretty easy, but I think for others is more like a definition?

I guess it depends on each individual glyph. e.g. for monadic +, conjugate seems like a good choice, since - flips the sign of the real part of a number… so you’d want a similar glyph to represent flipping the imaginary part of a number. And + is very similar glyph conceptually to -.

In the end though, yes, it’s the decision of Ken Iverson (and those that have followed in his footsteps) as to what each glyph should mean. There’s some etymology here:

https://www.jsoftware.com/papers/APLDictionary.htm

Now that you said conceptually similar I think I get why it flips the imaginary part…

So - flips in the real axes the number thus flipping its sign… so + flips the imaginary part along imaginary axes… thinking that way makes perfect sense… I guess will keep asking for “weird choices” which probably I will not get at first.

Guess it is not “matematically based” but makes sense.

Great!

Meaning pairings fall into these three groups:

Monadic form is like dyadic form with a default left argument

Glyph Default left argument
+ 0J¯2×11○x i.e. −2∙Im(x)
- 0
× ÷(|x)+x=0 i.e. (|x|+[x=0])⁻¹
÷ 1
* *1 i.e. e
*1 i.e. e
, (for scalars and vectors only)
? 1 (almost; scalar vs vector)
⎕UCS 0,⍳111411
⎕UCS 0,⍳111411
⌽⍳≢⍴x
⎕THIS
∘.=⍨⍳≢x i.e. In
,1 (almost, scalar vs vector)
⊂(≢⍴x)⍴1
∪x
⊂⍳≢⌷x
x
x

Both forms are good fit for the glyph

Glyph Explanation
indicates (3) layers of depth for the monadic form
indicates a counting rod marking for the monadic form
take elements and increase rank
drop elements and decrease rank
element of” and “enlist”
“enclose at positions where condition is met” and “enclose on condition of being simple”
indices where elements fit into intervals” and “indices where true”
,[1]x (for non-scalars) and ,⍤¯1 (for higher-rank arrays)

The two forms are conceptually related

Glyph Relationship
next higher integer or highest argument
next lower integer or lowest argument
| both forms can be called modulo and use the symbol: |x| and a|b
! factorial is prominent in the formula for binomial
both the trigonometric functions and π relate to the (unit) circle
~ “not” and “but not”
monadic means “not equal to any preceding item”
shape and reshape
indices of and index of
rotate and mirror along last axis
rotate and mirror along first axis
format and format with specification
6 Likes

Wow this is extremely helpful! Is that in the dyalog docs or aplwiki someplace?

It wasn’t. But I’ve now added it to the APL Wiki page on mnemonics, where you can also find other lists you may find useful.

4 Likes

I installed both Dyalog and RIDE on linux Mint. I can fire up Dyalog no problem. I can start the RIDE but it wants to “connect” to something on port 4502, and i don’t know how to point it to the running instance of Dyalog.

do I start dyalog in a terminal window with specific parameters and then point RIDE to that port for the IDE to talk to it?

EDIT: Ok, so I “kind of” figured it out, but “my solution” seems super convoluted:

  • I started RIDE and selected Type dropdown to: Listen
  • Then clicked the LISTEN button that appears under it, that gave me the instructions on how to start the Dyalog interpreter

Please start the remote interpreter with

RIDE_INIT=connect:host:4502

in its environment, so it connects here.

  • Then went to a terminal window and started the dyalog like so:
    – dyalog RIDE_INIT=connect:localhost:4502
  • This finally starts the familiar RIDE/Dyalog interface that I’m used to on MacOS with all the nice symbols at the top.

NOTE: If I copied the string from the dialogbox on the RIDE side it wouldn’t work, it has to have a proper hostname and localhost works fine as both processes are running on the local host (in 99.999 % of the use cases)

One thing I don’t understand is: Why doesn’t RIDE just fire up the interpreter itself and then connect to it? it can easily check if it’s installed and if it’s installed, there’s no difference in me going over to another shell window or it just firing one up? I’m sure there’s a good reason it’s set up to be like this though.

1 Like

You can let RIDE start Dyalog by selecting “Start” from the “Type:” selector. Specify parameters directly from the last box on that screen, and save various sets of settings to “profiles”.

Anyway, to answer your first question: just start Dyalog with RIDE_INIT="SERVE::4502"

1 Like

Interesting. The first time I chose “start” It couldn’t find the interpreter. Now that I’ve played around with the other option of connecting back to the RIDE from Dyalog started in a shell , I can select “Start” and it does find the interpreter. I think some config was missing and when I connected back from console to RIDE it may have tied those confg loose ends and now RIDE can see the interpreter.

1 Like

think it should be in quotes
aka: RIDE_INIT=“connect:host:4502”

1 Like

Sure you can.

3 Likes

Hi Jeremy, I did a quick “stocktake” after Session 13. The following list of glyphs has not been covered yet.

⍟⌹○!? ⊥⊤ <> ∨∧⍲⍱ ⊃⌷⍋⍒ ⍸∊⍷∪∩~ ⍀ ⌽⊖⍉ .@ ⍞⎕⍠⌺⌶⍎⍕ ⋄→∇& ¯⍬∆⍙

There is a placeholder for Slope Bar. But, the examples are the same as Slash Bar

4 Likes

Thanks for putting this together Sarada!

1 Like

Complex number manipulation can be easier in polar coordinate. For example Euler identity exp(j pi) = -1 can be interpreted naturally in the polar coordinates as shown below.

Multiplication and power also follow naturally.