10:57 AM
@Notone Hi there. Interested in APL?

11:22 AM
@Adám Mostly curious, although I don't have a strong programming background

@Notone That's perfect. Those with a strong programming background often struggle with APL :-) Can I offer a quick intro, or point you at resources?
Note that APL originates from traditional mathematical notation, so with a strong mathematical background, you'll feel much more at home looking at APL as an executable mathematical notation.

11:37 AM
@Adám Happily, as you noticed I come from a mathematical background. I would be interested in learning for what areas it is useful to use for or generally about its main merits (very generic question, I am aware).

It is especially useful for exploring algorithms, and giving domain experts access to have the computer help them in their work without needing to teach a general-purpose programmer about their expertise first.
It is a general-purpose programming language, but exceptional performance can be achieved for problems where an array-oriented approach works.
Its main merits probably depend on the subjective observer, but I find APL's expressiveness and harmonisation of otherwise notationally disconnected concepts are the most attractive to me.
@Notone Here's an example: ∏ and ∑ and ∀ and ∃ are expansions of × and + and ∧ and ∨ over a list. The four latter symbols are used in APL exactly as in traditional mathematics and formal logic. However, the four former symbols are not. Instead, APL uses `×/` and `+/` and `∧/` and `∨/`.

@Adám I see the pattern. Can you give a brief example with the ∃ or ∀ quantifier in use?

11:54 AM
Sure. Consider the list `⋄ L ← 3 1 4 1 5` (the `⋄` is just to invoke the bot). We can check which elements are less than or equal to 2 with `⋄ 2 ≥ L` and then ask if there are any such elements with `⋄ ∨/ 2 ≥ L`.

```@Adám
0 1 0 1 0
1```

So `0 1 0 1 0` indicates that the two 1s are less than or equal to 2, while the final 1 answers "yes, there exists such a number".
@Notone Was that clear?

Now, you can generate integers until `n` with `⍳ n` (that's a Greek iota), so you could compute the factorial with `×/ ⍳ n` e.g. `⋄ ×/ ⍳ 5`

@Adám `120`

12:01 PM
The powerful thing in APL is that you can use any two-argument function on the left of the `/`, even a user-defined one. That's a great thing about APL: user-defined functions and built-in functions are treated the same. The only difference between them is that user-defined functions have alphanumeric names, while built-ins use symbols. This way, there are no reserved words in APL.

What do you mean by two-argument function? A product over several numbers has several arguments

Right, but the fundamental operation is multiplication, which takes two arguments.
In APL, functions either take one argument, like `- n` for negation, or two arguments, like `a + b` for addition. To operate on many elements, a single argument list (or matrix, or actually any tensor) is used.
In fact, most symbols (and user-defined functions can do this too) have two meanings, one when given a single argument, and one when given two arguments. So, e.g. `-` is both negation and subtraction, just like in traditional mathematics.

so gcd would be a valid function I guess. And the gcd of a list would the gcd of all numbers in that list?

Yes, GCD is a two-argument function (it is in fact a domain-extension of `∨`), and you'd write `∨/ L` to get the GCD of the entire list. E.g. `⋄ ∨/ 12 18 9`

@Adám `3`

12:10 PM
@user1466569 Hi sunchi. If you want to participate here, please email access@apl.chat
Similarly, the maximum of two numbers is `a ⌈ b` so the maximum of a list is `⌈/ L ` as in `⋄ ⌈/ 3 1 4 1`

@Adám `4`

Makes sense. Everything is designed to work over integers, it seems?

Everything is designed to work over numbers. With APL, you almost never need to worry about the computer's internal representation.
However, character data is treated much the same, but you can't do arithmetic with letters :-)

However, there are also structural functions. You can reshape into a 3-by-4 matrix with `⍴` (Greek rho for reshape) with `⋄ 3 4 ⍴ ⍳ 12`

12:17 PM
```@Adám
1  2  3  4
5  6  7  8
9 10 11 12```

Similarly, we can reshape characters: `⋄ 3 3⍴'Notone'`

```@Adám
Not
one
Not```

Notice that `⍴` recycles the data if there isn't enough.

`⋄ 2 2⍴'Notone'`

```@Notone
No
to```

12:23 PM
Now you can transpose it with `⋄ ⍉ 2 2⍴'Notone'`

```@Adám
Nt
oo```

Or mirror it with `⋄ ⌽ 2 2⍴'Notone'`

```@Adám
oN
ot```

Or flip it upside-down with `⋄ ⊖ 2 2⍴'Notone'`

```@Adám
to
No```

12:24 PM
@Notone See the pattern in the symbols?

Yeah, a reflection along the line

Exactly.
In my opinion, much more mnemonic that trying to give (short) English names to these operations.

Fascinating, how many symbols are there in use?

About 80 or so, depending on if you count various forms of punctuation and other non-function things.
But as I said, many of them have two (usually related) meanings. E.g. `-` uses 0 (the identity element for subtraction) as "default left argument" and similarly `÷` uses 1 (the identity element for division) as default left argument, so one-argument `÷` is reciprocal: `⋄ ÷1 2 3 4`

@Adám `1 0.5 0.3333333333 0.25`

12:33 PM
@Notone I suggest you have a look at apl.wiki/Learning_resources

Yes, I will. Thank you

1:19 PM
@Prabhu @AndyLynch Hi. Interested in APL?

1:49 PM
@Nek Hi there. Interested in APL?

Hi!
Yep, coming from just a little bit of k lang background
just taking a look. not sure if APL is applicable to my domains (computer graphics, audio and music)

I'm pretty sure you can do anything. Graphics is a broad subject, but I've seen several distinct uses. Audio processing and music has been done. I'll see if I can track down some links.

ah, I've tried using APL for processing raw PCM data

oh wow! that's nice. didn't expect to get this kind of treatment just following a link :)

2:01 PM
Lots of new people here today. Where did you get a link to this room, if I may ask?

hackernews

Ah, I see. That explains it.

Extremely beautiful language and I'm a big fan of ideas from Notation
as a Tool of Thought (never read it entirely though)
It feels like coding GPU shaders in APL could be fun

2:07 PM
Yeah, the way GPUs work is very closely aligned with what APL is good at, hence apl.wiki/Co-dfns

There's specialk a limited K to (web) GLSL transpiler. Might be a fun project to remake it targeting APL :P

got to play with it! thanks for the link

@Nek Some ACM papers are APL applied in music theory and APL for music.

I'm looking for something more audio synthesis related. But I can bet working with music is fun in APL, 'cause math!

This might interest you: stanleyjordan.com/subjects/tools.html
@d125q Welcome. APL piqued your interest?

2:51 PM
@kmontgom Hi there. Curious about APL?
@JesseR Welcome to the APL Orchard.

3:29 PM
i was working on an algorithm, accidentally WSFULLed
and now the interpreter is spewing a "Syntax error" modal in a loop
and you can't kill it

4:05 PM
@KamilaSzewczyk Can you repro this?

:-(
I've never seen a popup like that from RIDE. I wonder if there was a glitch in the protocol between RIDE and the interpreter.

2 hours later…
5:43 PM
nevermind - I managed to reproduce it
under very similar circumstances
i think i ran into an interpreter bug right before doing so
the expression WSFULLed when i didn't expect it to, then the interpreter broke
and when i restarted the interpreter from a clear ws it started working
while i was playing with my code i noticed that my SI is growing really quickly even though i'm still in the REPL, i wonder if it's something to worry about

@KamilaSzewczyk That is definitely something to worry about. Sounds like a runaway recursion.

@Adám SI just displayed `pmat` 50 times
i took `pmat` from `dfns` so it's not my fault i guess
oh and my session logs were cleared for some reason

Ah, `pmat` is recursive.

so what has actually happened?

Just checking: Does grow when you let the interpreter sit, or only when you run your code?

5:59 PM
right now it doesn't grow at all, because i don't know the exact circumstances of this bug

Have you tried one of the alternative definitions in the notes, e.g. Roger's?

i can't really share my code publicly because of a bunch of requirements
but i believe that it's not important, even though it is recursive itself

@KamilaSzewczyk Ooh, exciting!