« first day (1246 days earlier)      last day (1403 days later) » 
11:00 - 22:0022:00 - 00:00

10:00 PM
hm ok. if i were to make an APL file what would it look like?
 
Like a mathematician went nuts :-)
 
RGS
@Adám +← 1000000
 
@RGS what does that mean?!
 
@matt That is a way of expressing a million upvotes using an APL pun.
 
RGS
@matt have you seen (y) or (+1) to show support / say you agree / etc on text-based platforms? well, in here we usually use +← 1 (a play on how APL works)
so me using +← 1000000 was me agreeing a lot.
@Adám ahaha, so literal
 
10:03 PM
i guess that makes sense. what would downvoting (-1) be then?
 
@matt Let's say that I have a list of measurements m. In APL I can sum them by writing +/m
@matt -←1
 
ah of course
 
And doubling the score would be ×←2
I can similarly find the product of them all with ×/m
 
so would sqrt-ing it be √←2 or something?
 
@matt No, that'd be the score'th root of 2.
 
10:05 PM
what does that mean ? as you can tell i really dont know much abt apples
:)
 
@matt It doesn't matter. These are just puns anyway.
We can count the number of measurements with ≢m
And we can compute the arithmetic mean average with (+/m)÷(≢m)
 
the monospace font looks terrible on my end. good job chromebooks
 
Increasing the font size might help a little. How does ≢ or look to you, like a slashed ≡ or like ≡ with a / next to it?
 
like ≡ with a / next to it
 
Yeah, that's an annoying thing in Chrome. It is supposed to look like but with three horizontal bars.
 
10:09 PM
screenshot:
sorry it's a bit tiny
 
OK, they at least touch each other so you won't confuse and ≡/
Anyway. Let's normalise the measurements in m so they add up to one: m÷+/m
 
what does THAT mean?
 
It means m divided by the sum of m.
This may seem trivial, but notice that we never looped or explicitly mapped over the values of m like most languages would have you do.
 
but wait how is m different from +/m ?
 
m is a list. +/m is its sum, or more precisely, + applied over m.
 
10:12 PM
NOW I GET IT
 
You can apply any function f over the elements of a list with f/
 
> future data scientist maybe, idk
note the word "future"
 
Where are you at now?
 
what do you mean?
 
If you're a student, on what level? (You don't have to tell, of course!)
 
10:15 PM
mind if I skip that one?
:/
 
No problem at all.
You know + - × ÷ from primary school, I presume.
 
definitely
and √ and ^
 
Well, ^ is not really used in school, only in programming, unless you mean logical AND.
APL adds a bunch more for all kinds of nice things. E.g. a⌈b is a or b, whichever is the largest value .
 
traditionally I'd call that ceiling(a,b)
my comma key hates me right now
 
Yes. But that name ceiling actually comes from APL's symbol which is a wall with a piece of the ceiling!
Similarly is a wall with a bit of the floor, so a⌊b is that.
 
10:19 PM
[surprised] really? never knew!
 
RGS
@matt wait, really? I'd call "ceiling" and "floor" to the functions that round numbers to the nearest integer (above or below) and I'd call "max" and "min" to these two functions
 
oh right facepalm
 
Wait, facepalm here too. Yes.
But the things about their names is still true. It is just that ⌈a is the ceiling of a.
 
right
 
APL's inventor was a mathematician, not a computer scientist, and he invented a few things that made it into mainstream mathematics. APL was his masterpiece though, for which he won an award.
 
10:21 PM
there ya go
 
Now you can notice a fun thing in APL. Functions like these can be used with one argument (on the right) or with two arguments (one on each side), just like the - symbol can be used in TMN (traditional mathematical notation).
 
right like how -4 is different from 6-4
 
Exactly.
 
one is -4 and the other is 2
 
Yes. The first is the negate function and the second is the subtract function.
 
10:23 PM
"let's learn math kids! but with really cool symbols and things!"
 
Yup.
 
APLers call one-argument functions "monadic" and two-argument functions "dyadic".
 
makes sense. I just made myself a google docs thing that replaces "sqrt " with "√"
 
Often, the two meanings of a symbol are closely related. E.g. -a is the same as 0-a
 
10:24 PM
right right
 
In APL, you can also use ÷ monadically like ÷a and it is the reciprocal, i.e. 1÷a
 
hm interesting. should I be taking notes?
 
You don't have to. You can find all this quite easily.
Actually, now you already know most of the types of pieces that APL is built from.
 
prob'm is the wikipedia article en.wikipedia.org/wiki/APL_syntax_and_symbols doesn't make much sense at all
 
@matt I know. aplwiki.com is much better.
 
10:27 PM
interesting
 
A really nice thing in APL is that all the normal built-in functions have symbols. There are no reserved words.
 
hm
 
This means that you don't have to "be a programmer" that knows all the reserved words to avoid problems. There simply aren't any.
 
think my"few minutes" are up :/
 
@matt No problem. I should go to bed too. I hope I whetted your appetite for more. You're always welcome back.
 
10:30 PM
bed at 3:30pm?
 
@Adám do you have time for one more quick Q?
 
RGS
@matt ahaha, we are in different time zones
 
yep
 
@matt It is 11:30pm by RGS and me :-)
@FredrikNiemelä I can't resist. Go ahead!
 
ah so you guys are in *timezone lookup* London?
 
10:32 PM
I'm in London. My location is in my user profile too.
 
i'm ~halfway across the planet in vegas
 
∇f
{⎕←1↓0⍕|-/⍎⍵}⍞
→1

f

mostly solves the problem "different" and needs no EOF. But the *first* output row is "right justified" (or maybe just has a bunch of spaces prepended). Why is that?
 
wow what is that??!
 
@Adám (That's basically your code from earlier)
 
@FredrikNiemelä A bug really. It wasn't like that in 17.1. That's why I redirected stderr to null in my email.
 
10:34 PM
Ah... let me try that...
 
RGS
@matt Portugal, here :) but same TZ as London
 
Yep... that fixes it
 
ah ok
 
We will only be capturing stdout (and ignoring stderr) anyway... so yay... we have a solution.
 
(What is actually happening is that the interpreter prints a few spaces for you to enter the lines of your function. Of course, this doesn't make any sense when in -script mode.)
 
10:35 PM
ok guys gotta go
 
@matt Bye ○/
 
@Adám Now is this terribly unidiomatic APL?
 
RGS
@matt bye! Hope to see you back in the future!
 
...I mean the goto doesn't feel great
 
you ... might. hopefully
 
10:36 PM
@FredrikNiemelä Not really. I'd not use hard-coded line numbers, and there are more elegant ways of doing it.
 
Ok... good. But at least we know it's possible.
 
As long as you don't have a problem where one needs to capture an unknown number of lines, and then process them, yes.
 
Can't promise that there are none.... but it's not very common at least
 
{⎕←1↓0⍕|-/⍎⍞}⍣{0}⍬ should work. As should {∇⎕←1↓0⍕|-/⍎⍞}⍬
I.e. you don't need that wrapper function at all.
 
RGS
@Adám ...⍣(0⍨)⍬ ?
 
10:39 PM
Yes, both of those works... but only if you add an explicit newline to the file
 
@RGS Heh, yes, but that's longer.
 
RGS
@Adám I know, but looks cooler!
 
@FredrikNiemelä Where do you mean, after that line? Or in the input?
 
@RGS could you explain to the noob? (i.e. me)
 
@FredrikNiemelä It is a new language feature in 18.0 that value⍨ is a constant function.
 
10:40 PM
@Adám after the line in the source file
 
@FredrikNiemelä So it needs TWO trailing newlines?
 
No, just one
 
RGS
@FredrikNiemelä I'm a noob too haha; {0} is a constant function and I replaced it with another constant function, new in 18.0
 
well i came back
 
@RGS Ah... I agree that it looks cooler :)
not that that is a good metric :)
 
10:42 PM
@FredrikNiemelä Oh, but according to the POSIX standard (which Linux follows) a non-empty file must have a trailing newline. Otherwise it is an invalid file.
@matt That was quick.
 
RGS
@Adám oh wow
 
@Adám heh
 
1397
A: Why should text files end with a newline?

Konrad RudolphBecause that’s how the POSIX standard defines a line: 3.206 Line A sequence of zero or more non- <newline> characters plus a terminating <newline> character. Therefore, lines not ending in a newline character aren't considered actual lines. That's why some programs have problems pro...

 
@Adám Right, I don't disagree
@Adám btw the earlier solution with trailing EOT required a trailing newline after the EOT to work... which is both correct and very broken
 
@FredrikNiemelä Right, because the EOT didn't actually terminate anything, it was just a very unlikely line I could recognise.
 
10:47 PM
Right
 
Btw, will you ever have empty input lines?
 
I mean... it could happen I guess, but I don't know of any such cases...
Maybe when an input line is a literal string and the empty string is an allowed input?
Would that break things?
 
No, I was just thinking that one could stop asking for more input when getting an empty input.
 
But you would never get empty input because there would (normally) be only one trailing newline, not two
 
think I ate too many apples
 
10:50 PM
really doesn't care. It eats everything until the next newline, even control characters.
@FredrikNiemelä True, but it could be used as a light-weight convention.
 
I was considering using the ⍞ with timeout... but that's kinda ugly
 
@matt Just wait until you begin consuming APL pi:
 
how is THAT pi?
 
@FredrikNiemelä And it resolution isn't good enough. Currently the minimum timeout (using the built-in method anyway) is 1 second. I'm considering asking for that to be enhanced to handle fractional seconds.
 
but srsly I love apple pie
 
10:52 PM
@matt That's just another of APL's symbols. Monadic (one-argument) is "pi times", so ○2 is 6.283185307
 
aka tau
 
Yup.
The symbol is of course a stylised pie seen from directly above.
 
@Adám Do you think the APL devs would be against adding support for reading until end of stream?
 
@Adám i doubt that
 
(Also, but that's secondary, in my opinion, it symbolises that pi is the fraction between the circumference and diameter of a circle.)
 
10:54 PM
@Adám I don't think we need it, but IMO it really should be supported.
 
@FredrikNiemelä No, not at all. In fact I know it, because I spoke with our chief architect about it today. This is something I'm sure we'll address in 19.0.
 
"we"?
 
+← 1
(Did I do that right?)
 
looks like it
 
@matt I help develop the language.
 
10:55 PM
cool!
 
@Adám when is 19.0 expected?
 
In a year. We just released 18.0.
 
@FredrikNiemelä Btw, you do realise why that is taken as "upvote", right?
 
Yes
But thanks for checking :)
 
10:59 PM
People often forget that APL's modified assignment is completely general, and you can use any function to the left of . Sometimes the main code can live there.
 
Yes... my son has been using that for some of his recent APL code...
...for the untrained eye it feels jarring
 
      v←3 1 4 1 5 9 2 6 5 4
      v{⍺/⍨⍺<⍵}←5
      v
3 1 4 1 2 4
Hey, now with 18.0 we can even do
      v←3 1 4 1 5 9 2 6 5 4
      v(<⊢⍤/⊣)←5
      v
3 1 4 1 2 4
 
wait what? I got the first one...
 
@FredrikNiemelä If you're going by Mastering Dyalog, then you've not met trains yet.
 
sideways T is identity, right?
/ here is replicate?
 
11:02 PM
Yes and yes.
 
Oh...
so less-than-same atop replicate-same ?
 
@FredrikNiemelä No, less-than same-atop-replicate left
Operators bind first. So binds and /
 
Ah... yes... and that makes more sense
 
now what is happening?!!
 
@matt well...
we're talking through v(<⊢⍤/⊣)←5
 
11:06 PM
[eyeroll] and what does that mean?
 
first...
val anyfunc←otherval simply means
val ← val anyfunc otherval
 
I... I give up
 
@matt It means filter the variable v in-place, preserving only elements less than 5.
 
like a += b is a = a + b in many languages
 
I still give up
 
11:07 PM
Do you know C++?
 
nope
 
Ah
What languages do you know?
 
@FredrikNiemelä (Should have been called ++C imo)
 
js & html are basically it
 
Well js, does have +=
 
11:08 PM
true
 
But even JavaScript allows v=42; v+=1
 
a += b
in javascript means
a = a + b
 
yes
 
In APL the + can be any function
 
And the assignment is not =
 
11:09 PM
@Adám which makes v=43
 
so
a myfunction= b
would be
a = a myfunction b
 
ohhh i get it
 
but also... as @Adám said. = is ←
soooo
 
@matt Yes, and so to in APL:
      v←42
      v+←1
      v
43
 
why the indent?
 
11:10 PM
v(<⊢⍤/⊣)←5
means
assign v function 5 to v
 
In interactive mode (a REPL) it is customary to indent user input 6 spaces and have output flush left.
 
also how crazy is apl syntax highlighting?
 
where function is that stuff in the middle "<⊢⍤/⊣"
 
right
 
Hmm.. I've never seen APL syntax highlighting. @Adám what does it look like?
Now.. the funtion here is actually 3 functions connected together
<
⊢⍤/
 
11:12 PM
You can see coloured APL on TryAPL.
 
@Adám A right... sorry I retract my statement and claim the opposite
 
That's a bit over the top on happy colours for my taste, but in an actual IDE you can choose or design your own scheme.
 
Fun fact: APL can syntax colour itself.
 
whaaaaaat? how!
 
11:13 PM
@matt
The first function < return true booleans for all places where v is less than 5
yes... whaaaat?
Sorry guys I need to head out...
 
(was referring to how apl can color itself)
 
yes... me too :)
@Adám can probably continue to explain the code better than I can. I've only known the language for a week or two.
 
oh uh
a week?!
 
...or two
 
@matt Yes, it is really easy to learn.
 
11:15 PM
for you!
 
It's really hard at the very beginning. since it just looks like greek
 
i couldn't agreemore
 
But when you understand the basics it all makes complete sense quite quickly
 
agree more
 
APL colouring APL:
 
11:16 PM
Anyway.... gottago!
 
      code←'∇foo' 'v←3 1 4 1 5 9 2 6 5 4' 'v{⍺/⍨⍺<⍵}←5' '∇'
      cols←200⌶code
      ↑code⍪⍤,¨¨cols
┌───┬───┬──┬──┬──┬──┬──┬──┬───┬──┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│  ∇│ f │ o│ o│  │  │  │  │   │  │ │ │ │ │ │ │ │ │ │ │ │
│180│21 │21│21│0 │0 │0 │0 │0  │0 │0│0│0│0│0│0│0│0│0│0│0│
├───┼───┼──┼──┼──┼──┼──┼──┼───┼──┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│v  │ ← │3 │  │1 │  │4 │  │1  │  │5│ │9│ │2│ │6│ │5│ │4│
│7  │19 │5 │5 │5 │5 │5 │5 │5  │5 │5│5│5│5│5│5│5│5│5│5│5│
├───┼───┼──┼──┼──┼──┼──┼──┼───┼──┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
 
doesn't work for me
 
@matt Where? TryAPL?
 
yeah
 
No, TryAPL is very limited. You can download the full system from here.
 
11:20 PM
doesn't support my lil chromebook :(
 
though it doesn't have latest features of 18.0
 
@Bubbler You're so much quicker than me!
 
what do the boxes and numbers mean in the output?
 
First line in each box is the character in the code, and the number below it is the color code
 
in... deciaml?
decimal
 
11:23 PM
Yes
 
It is actually better than a colour code. It is a code for what syntactic role that character has.
 
more bad monospace
and what is a syntactic role and their codes?
 
e.g. number literal has code 5, function name foo has code 21
 
We can even ask APL that too:
      5{⍵[⍵[;2]⍳⍺;1 3]}201⌶0
┌────────────┬───────┐
│Global token│MINI_NC│
└────────────┴───────┘
Number 5 is a global token, namely a Numeric Constant that was identified by the "mini-scanner".
 
this is a very deep rabbit hole
 
11:27 PM
      21{⍵[⍵[;2]⍳⍺;1 3]}201⌶0
┌────────────┬──────────┐
│Global token│MINI_FNAME│
└────────────┴──────────┘
21 is a global token, namely a Function NAME identified by the mini-scanner.
 
My guess was right :)
 
1=comment
2=UCC?
 
Btw, there's are a couple of puns here too.
 
3=white
4=CC
 
UCC: Unicode Character Constant if I recall right.
 
11:29 PM
"white"?
 
whitespace
 
"CC"?
 
(single-byte) Character Constant
But mind you, you never need to use these codes, unless you're doing some serious "meta-programming".
 
so how do the codes do syntax hilighting?
 
You can use them to assign classes to <span>s.
 
11:32 PM
HTML + APL ?!!
 
That's what we did here (click "View: APL code")
Yeah ^ is a website defined in APL (as you can see by viewing the code behind it) running on a webserver that's also written purely in APL.
 
what's that amazing font?
 
Are there any helpful funcs or techniques for maneuvering around through a matrix in APL? For instance for maze games/solving, if you want to take numerous steps, each time remembering your current position, and then 'moving' accordingly as a function of your neighboring cells...
 
@matt That's what happens if you use a proper font instead of the ChromeBook's default.
 
At the moment, all I can think of to help is the stencil primitive, but its usefulness is limited here
 
11:35 PM
@AviF.S. I'd just remember the current position and then chop around that to get the neighbours if needed.
 
is it APL385?
 
Yes.
@matt You can find it and more here.
 
@Adám By chopping do you mean ↑↓?
 
@AviF.S. Yes.
 
There must be a better way, no?
Also, that begs a tradfn which I'm trying very hard to avoid...
Trying to think of a slightly less procedural way, if possible
 
11:38 PM
@matt Here's the code that created the syntax colouring you see on the website.
 
@AviF.S. One way is to model the game states as a graph and throw in shortest path etc.
 
so what things are what colors?
 
@Bubbler Good idea for an actual maze solver. Unfortunately, it's not quite what I'm trying to do, just the closest analog I could think of...
Anything that can thoughtfully trace through a matrix (by 'thoughtfully' I mean step through in a manner dictated by its neighbors at each step), is what I'm looking for
Any mechanism that'll neatly allow that, I mean
 
@matt CSS here.
 
> step through in a manner dictated by its neighbors at each step
 
11:43 PM
I thought there might be more stencil-like tools in the library I was missing that one could perhaps use to run the logic on the matrix all at once, first. Before then tracing through it (if that makes sense)...
@Bubbler What about that?
 
Then you can compute the next move for every position in the matrix beforehand
 
@adan hm
 
@Bubbler Exactly! That's what I'm doing with ⌺
But I still need a way to then trace through it, and I'm really trying very hard to not utilize the tradfn constructs. But I'm afraid I'll have to use a while loop...
 
And then a graph search algorithm will automatically find you the path you'll take
 
@Bubbler But there's no question as to what the correct path is. I don't have to find the best one from several, nor optimize.
I just have to follow the 'instructions' as given by the neighbors, to trace through once
In a particular fashion
So I'm afraid graphs won't work. Really it's just a while loop that updates a pointer with the current position until it's at the end
 
11:47 PM
If you have only one possible step at every position in the matrix, the path will be definitely linear, but you still need to compute it
 
Just hoping there's a purer APL way to do that, because I distrust :Constructs deeply
 
And a linear path is still a graph.
 
where are all the apl things in unicode?
 
@matt Miscellaneous technical mostly.
 
Miscellaneous Technical is a Unicode block ranging from U+2300 to U+23FF, which contains various common symbols which are related to and used in the various technical, programming language, and academic professions. For example: Symbol ⌂ (HTML hexadecimal code is &#x2302;) represents a house or a home. Symbol ⌘ (&#x2318;) is a "place of interest" sign. It may be used to represent the Command key on Mac keyboard. Symbol ⌚ (&#x231A;) is a watch (or clock). Symbol ⏏ (&#x23CF;) is the "Eject" button symbol found on electronic equipment. Symbol ⏚ (&#x23DA;) is the "Earth Ground" symbol found on...
 
11:50 PM
mostly?
 
@Bubbler Hmm... I'm not really sure that's an efficient use of resources, though. It'd take far more ingenuity and complexity to convert it than to solve as is...
 
@matt Lots of plain ASCII in use too.
 
@matt Stuff like that's not specific to APL is elsewhere.
 
@AviF.S. Then a simple -loop should do.
 
@Bubbler Oh my god, what an idiot!
 
11:52 PM
@adam hm
 
It certainly won't be anywhere near simple, but you're right.
 
Like, {move one step}⍣{nowhere to go}(initial position)
 
I totally blanked and forgot that they could also handle conditions :(
 
@adam if only there was a simple comprehensive list that made sense to ordinary people
 
@matt List of what?
 
11:54 PM
list of APL symbols
 
@matt Just so you know, you can just type @a or @A and then press tab, and it'll autocomplete his name!
That way it'll also ping him, if he's not looking!
 
@matt ^ or look at the "Primer" tab of TryAPL.
 
@matt Also, you can reply directly to a message, and it'll ping the writer of it automatically while linking back to to that which you're replying
 
I'm familiar with how to use the chat btw :)
 
11:57 PM
@matt Ah, sorry about that!
 
no prob :)
 
I knew absolutely babkas and was completely lost still like two weeks ago. It took me ~month to learn you could reply to people...
 
11:00 - 22:0022:00 - 00:00

« first day (1246 days earlier)      last day (1403 days later) »