« first day (1295 days earlier)      last day (1349 days later) » 

12:01 AM
illegal code complaints fixed now;
⋄ ((3=+/¨∘|)(/⍨⍨)⊢)(,∘.,⍨¯2 ¯1 1 2) ⋄ ¯1 ⎕DT 44053.674
 
@Moonchild
 ¯2 ¯1  ¯2 1  ¯1 ¯2  ¯1 2  1 ¯2  1 2  2 ¯1  2 1
 2020 8 11 16 10 33 600
 
@AviFS should be possible, yes, though it requires some extra bookkeeping and complexity
 
I use str.translate and str.maketrans pretty frequently so yeah but some of the other static methods definitely not
 
12:35 AM
what's the easiest way to do something like (1↓'string')(¯1↓'string) ?
 
@rak1507 You are possibly interested in windowed or N-wise reduction (dyadic f/). But there's not any special trick for the thing you wrote.
 
Ok thanks
Yeah pretty sure I want n wise reduction, another clever thing I always forget!
 
1:19 AM
P6←(10|'0123456789__ADGJMPTW__BEHKNQUX__CFILORVY_______S_Z'∘⍳)¨ pretty sure hardcoding a string and using the modulus wasn't the intended solution, but it's fun nonetheless
 
 
2 hours later…
3:29 AM
@Adám
I'm kinda interested
I currently have my eyes on Aya right now
but apl looks really cool
 
3:55 AM
@Razetime That does look very interesting, and quite APL-like, I must say.
A benefit of APL is already being an established language with lots of resources. Let me know if you want a quick personalised intro.
 
4:06 AM
@Moonchild Sure, but don't you think the bot should stick to defaults, even if they are bad?
⋄ '%ISO%'(1200⌶)1⎕DT'J'
 
@Adám 2020-08-11T21:07:40
 
a personalized intro, sure!
I remember hearing steve wozniak say he's programmed on an APL keyboard before
 
@Razetime When? Now?
 
no, some youtube video
oh sure yes now
 
I can see a bit of your programming background on your profile, but do you mind telling me how you are with mathematics in general?
 
4:14 AM
average
very average
I'm learning Engineering math
That's my level
I'm at linear differential equations
 
Ah, OK, so high-school level plus linear algebra is fine.
 
cool
I already downloaded a book on Dyalog APL
 
Nice.
So, the first step is to forget APL is A Programming Language :-D
Instead, think of APL as an alternative to Traditional Mathematical Notation (TMN)
A lot of the good stuff from TMN lives on in APL:
⋄ 2+3 ⋄ 2×3 ⋄ 2÷3
 
@Adám
5
6
0.6666666667
 
What makes APL stand out, is that it generalises and harmonises many concepts from TMN.
E.g. TMN has ∑ for the sum of a list and ∏ for the product of a list.
APL generalises this to allow any dyadic function (an infix operation taking two arguments) to be applied in that manner of combining the elements of a list:
 
4:23 AM
so it works like a math expression
 
⋄ +/(3,1,4,1,5) ⋄ ×/(3,1,4,1,5)
 
@Adám
14
60
 
@Razetime Yes, exactly. APL is like a desktop calculator, so powerful that you can write full-stack applications in it.
 
you have a bot which compiles APL?!
 
APL is usually interpreted, but yeah, the bot evaluates messages that begin with (the statement separator in APL).
 
4:25 AM
that isthe coolest thing ever
 
APL is really well suited as an in-chat language, because it is so compact.
 
it makes a lot of sense
 
Now, one of the problematic things in TMN is the order of execution, or the precedence order. You may have learned it as PEMDAS, BEDMAS, BODMAS, or BIDMAS, but it is really much more complicated than that.
 
okay, so it's different from general precedence in programming langs
 
In fact, it is so complicated that TMN is ambiguous. E.g. what goes first, the application of a trig function like sin or implied (no symbol) multiplication?
 
4:30 AM
so you have to figure it out in the process of debugging?
 
Other languages that try to use TMN's order, and extend it for additional operators, either end up having to enforce parentheses, or build a too-large-to-remember table of precedence (C++, anyone?)
 
yeah C++
and schools make you remember it for no good reason
 
Well, APL generalises a very simple rule from TMN. It simply takes the rule for multiple applications of power, or if you want, multiple applications of functions, and makes it apply everywhere.
 
I need to read up on that
 
So, e.g in TMN ₂3⁴ (sorry for the bad rendering, no true superscripts here in chat) is ₂(3⁴)
 
4:32 AM
@Adám (Actually, now Python wins at 18 levels over C++'s 17 levels)
 
Yikes.
And f(g(h(x))) goes from the the right too, i.e. h() is evaluated first, then g(), then f().
 
oh ok
thats a general rule in callable functions in most languages right
just that APL holds it for all functions
 
In APL, all functions take everything on their right, as far as they can "see" (until the end of the line/expression/parenthesis) as their right argument, while they only take the data to their immediate left as left argument (if any).
 
<moon-child> @Bubbler, tbf, some languages (raku, seed7) let you define your own operators with arbitrary precedence
 
@moon-child, I shiver thinking about how it'd be to read other people's code if they use that.
 
4:35 AM
Fortress let you use spacing around operators to indicate strength of binding
 
So does I, but it becomes untenable after a couple of levels.
So, APL allows you to get rid of parentheses on the right: f(g(h(x))) while valid APL, can simply be written as f g h x
⋄ 2×3+1
 
@Adám 8
 
so you should figure stuff out
 
@Razetime Understand why ^^ ?
 
and then write programs
its like programming in Arabic
 
4:39 AM
Sure, if you want. But actually, it reads like English:
> Drive the red cars
red modifies cars
Drive acts upon the red cars
So you must evaluate red before Drive.
 
when put in function notation it looks like arabic
but since functions are nested its more like english
 
Another focus of APL, is array orientation. For mathematical functions, mapping is implied:
⋄ 2+3 4 5
 
@Adám 5 6 7
 
Notice that a list doesn't need parentheses and commas, though it is still valid with them.
In fact, you can also "double-map" or "pair-up" two arrays:
⋄ 10 20 30+4 5 6
 
@Adám 14 25 36
 
4:46 AM
@Adám fair enough. Switched to ⎕io←1
 
@Moonchild Just in time too…
@Razetime Very often, you want to work with natural numbers or indices. For that, APL uses the Greek letter Iota:
⋄ ⍳10
 
@Adám 1 2 3 4 5 6 7 8 9 10
 
Computing the answer for Gauss' teacher:
⋄ +/⍳100
 
@Adám 5050
 
I should get anapl layout
apple probably has a preset for that
 
4:49 AM
For now, you can just use this bookmarklet.
 
<moon-child> (note that other programming languages also use iota to mean a range of numbers; e.g. c++)
 
@moon-child Also Go, Scheme (SRFI 1) and ArrayFire.
 
Ah, go
 
@moon-child Would it be an idea for the bot to evaluate even inline code in messages if they begin with a diamond?
That'd allow explanatory text together with code in a single message, ⋄ 'like this'
 
⍱⍒⊂∊⌿\⍉⍴⎕ ⍎⍞
 
4:54 AM
@Razetime Here's a challenge for you: Can you make an APL statement that computes ∏ (2,4,6,…,20) ?
 
Mommy, I'm speaking in APL!
 
You are, and that's almost a valid expression too.
 
Haha
does that mean product of sum?
 
The product of the first ten even natural numbers (i.e. from 2 to 20)
 
. ×/(2,4,6,8,10,12,14,16,18,20)
⋄ ×/(2,4,6,8,10,12,14,16,18,20)
 
4:57 AM
@Razetime 3715891200
 
That's right. But can you generate the sequence instead of hard-coding it?
 
not sure how to generate a list
 
Remember ― and feel free to experiment.
 
. 2×⍳10
. 2×/⍳10
. ×⍳10
 
I wonder why you get .s instead of s.
Pro tip: ` ` (two backticks) will give you a
 
5:00 AM
gotta learn my way around the symbols
 
No problem. Take your time. It can take days to learn all of APL.
 
⋄ ×/⍳10
 
@Razetime 3628800
 
⋄ 2×⍳10
 
@Razetime 2 4 6 8 10 12 14 16 18 20
 
5:02 AM
⋄ 2×/2×⍳10
 
@Razetime 8 24 48 80 120 168 224 288 360
 
hmm
 
Why the left-most 2?
 
@Adám days! :D
 
⋄ ×/2×⍳10
 
5:03 AM
@Razetime 3715891200
 
Bravo! Your first involved APL program.
 
that was very fun
 
Want more?
 
I have classes now, should be going
 
No problem. You can always ping me (@Adam) if you want to continue.
 
5:08 AM
I'll hang around and see if I can learn from the banter
sure!
 
5:36 AM
I downloaded Dyalog APL from the website
 
@Adám done! Also supports having multiple code blocks (⋄⊢x←10 is followed by ⋄⍳x)
 
@Moonchild
10
1 2 3 4 5 6 7 8 9 10
 
6:16 AM
@Moonchild Wow, that's so cool! It essentially makes each message like a notebook.
If ⋄ n←10 then the first n natural numbers are ⋄ ⍳n and their sum is ⋄ +/⍳n
 
@Adám
1 2 3 4 5 6 7 8 9 10
55
 
6:54 AM
Good morning all, I've written an article about rational representationh for Raku's 20 year advent series that looks back at the individual RFCs that started the (slow!) process of Raku's development. raku-advent.blog/2020/08/12/…
tl;dr - ab5tract has a change of mind thanks to the patient discussion of @ngn, @dzaima, @Marshall, and others.
 
@ab5tract This new material by Roger may interest you.
Continues here.
 
@Adám, indeed I stumbled down Roger's work all the way into an email thread with him :)
 
 
1 hour later…
8:02 AM
@ab5tract nice article! (Also, appreciate the nod to j :)
@ab5tract typo in 'Raku does it’s best' and 'anyone who wants to ensure it’s use' (both should have 'its')
 
@Adám Roger's forum posts are amazing -- it would be great to see those collected into a more accessible form, like a bunch of blog posts etc.
 
@xpqz Yeah, the forum format is crazy. Roger went with that because he has direct access. I can ask him if he allows people to make e.g. Jupyter Notebook docs of it.
 
8:41 AM
@Moonchild thanks!!
@Adám I often find a relatively quiet yet active forum to be a good place for the kind of writing Roger is doing there -- but agree that it would be great for additional layers of writing / analysis / examples that highlight / point back to the forum.
It's definitely a great resource. I only thought to search the forum after impulsively sending an email of subject "Where did the rationals go?" to Dyalog support (upon encountering the presentation from Dyalog '11). Hopefully next time I can remember to reverse the order ;)
@Moonchild Addressed! In fact there were quite a few more.. I used to be really proud of my its/it's capabilities but I'm increasingly getting all sorts of homophonic typo errors out of these fingers lately
@xpqz I've thought similar things about the APL Cultivations. Amazing content but could potentially use a third party commentary in a nicer-for-code-snippets medium. It's one of (too?) many blog series I'm thinking about at the moment.
@ngn @dzaima @Marshall I hope you will accept my thanks and apologies for my sides of the friction the other day. I say as much in the article as well but I like my new, more informed opinions about rational numbers much better.
 
ngn
9:26 AM
@ab5tract i don't think there's anything to thank or apologize for here. having an argument is the fastest way to get to the truth, and sometimes technical arguments can get very intense. i'm glad you're back and nobody appears to be taking the discussions personally. reading your blog right now..
 
10:13 AM
@ab5tract We've already begun converting some of the Cultivations to Jupyter Notebook, for stand-alone use and as TryAPL lessons.
 
@ngn There was some k chat today on HN in news.ycombinator.com/item?id=24119118 btw.
 
@Adám Awesome! Is that the basis on the introduction series notebooks that Richard has been ushering or is it a separate project?
@ngn Thanks for that. I would have been back earlier but was waiting to have tangible results of the discussion in hand and today was the day my post got scheduled for publication :)
 
RGS
10:29 AM
@ab5tract "[...] individual and arrived withing minutes [...]" should be "[...] individual and arrived within minutes [...]"
 
@RGS Fixed now. Thanks for reading!
 
RGS
@ab5tract thank you for writing :)
 
ngn
@xpqz thanks. yeah, it gets a mention every now and then, usually still as q/kdb+ and less often as shakti. even my ngn/k had its own 15 minutes of fame once, mostly comments about the coding style.
 
:)
@ngn I wonder how many people are like me and sort of waiting for Shakti to "fully congeal" before diving in
 
@ab5tract Yeah, quite -- the constant core dumps got annoying last time I played with it.
 
ngn
10:37 AM
@ab5tract if you're waiting for that, you're missing a unique opportunity to influence the course of array language history :)
 
kdb/q is super well documented at this point. Q for Mortals is great and the Jeff Borror's video series was a "seemingly harmless, secretly a wormhole" intro into this crazy world of array programming
@ngn You raise an interesting point :)
 
10:57 AM
@ngn Did you mention / vs \ ?
 
ngn
@Adám in what sense?
 
@ngn That \ should be reversed intdiv and / should be reversed mod.
@ab5tract That's separate. The Cultivations go here and are included on TryAPL under "Closer Looks at Some Functions". We just need more volunteers to continue converting lessons to notebooks.
TryAPL 3.0 is well on the way, and will handle a much larger subset of Jupyter notebooks.
 
@Adám Where should I send formal notification of intent to volunteer? :D
 
@ab5tract You can just PR.
 
ah :)
 
ngn
11:08 AM
@Adám we discussed this possibility in the k tree long ago (i'm still trying to find the link..), but some of us didn't like it because the args seemed swapped. later it appeared in what was at the time k7. if someone brought this particular idea to arthur's attention, it wasn't me.
 
 
2 hours later…
RGS
12:45 PM
@Adám do you have a preferred spell-checker?
 
@ab5tract No hard feelings for sure. Glad you're back!
@ab5tract Looks like you're missing the closing > of <ol for the footnotes.
 
1:17 PM
@Marshall cheers! :D .. and fixed
 
1:54 PM
@RGS My browser (FF) or site (gmail) tends to do the job. Otherwise I just put things into Microsoft Word.
@RGS (btw, there's a coffee break in 5 mins)
 
RGS
2:39 PM
@Adám FF doesn't do it for me in jupyter notebooks
@Adám only saw your msg now, I don't think I'll be able to join :/ much work to do
 
@RGS Still ongoing, but no worries. It is completely optional. We're only four there right now.
@RGS Maybe some of this:
41
Q: Highlight typos in the jupyter notebook markdown

Salvador DaliWhen I write something in the jupyter notebook markdown field, the typos are not highlighted and often I ended up with something like this: In almost all IDEs I have used so far, the typos are highlighted with a curly underline which was very convenient for me. Something like this: Up till ...

 
RGS
3:18 PM
@Adám awesome
 
RGS
4:09 PM
@Adám when I am running a Dyalog APL jupyter notebook, I get a lot of things printed to the console; is this something I can avoid?
 
@RGS That's part of the kernel. It performs the function of RIDE's Protocol log (Ctrl+F12), but I agree that it shouldn't do so normally. I think it was made to do that to debug the kernel when we were developing it. Maybe amend this to only do so if a debug flag is set (e.g. an DYALOGJUPYTERKERNELDEBUG=1 evironment variable).
 
 
2 hours later…
RGS
5:57 PM
@Adám thanks :)
 
 
1 hour later…
7:06 PM
Self-compiling BQN.
Javascript VM, basically single-threaded: 1m25.567s
Go VM, using most of an extra core: 1m23.792s
Okay...
 
 
1 hour later…
8:30 PM
For phase 1 question 6 from last year, what is the best way to do it? Translating letters to the numbers on a keypad. Only way I could think of was
P6←(10|'0123456789__ADGJMPTW__BEHKNQUX__CFILORVY_______S_Z'∘⍳)¨
 
@rak1507 my solution was {something[(⎕A,⎕D)⍳⍵]} where that "something" can be less hardcodey
 
I'll have to look up what quad a and quad d do
 
@rak1507 they're the uppercase alphabet & digits constants
 
Ahh cool
 
8:56 PM
@dzaima Look into dyadic .
 
@Adám that's smart
 
@dzaima I've got 22 with ⎕IO←0 or 24 with ⎕IO←1
 
@Adám i have 22 in ⎕IO←0 too
 
RGS
@Adám sounds like a '1+' or '+1'/'-1' difference somewhere
 
@RGS But isn't in my case.
 
RGS
9:05 PM
@Adám wow so the 2 byte difference isn't an off-by-one correction?
 
@RGS Sure it is, but not using addition or subtraction.
 
RGS
@Adám hm ok, interesting
 
9:18 PM
@dzaima 22 in ⎕IO←1 too.
 
9:31 PM
22 characters for what?
 
P6
 
Oh right! Wow
 
I'll give you a hint: dyadic (but my solution is very out-of-the-box)
 
Yeah, I thought that could be useful when doing the problem, but couldn't think of a clever way of doing it
 
@rak1507 Why the (?
 
9:41 PM
Late night tiredness I guess lol, good question
down to P6←10|(⎕D,'__ADGJMPTW__BEHKNQUX__CFILORVY_______S_Z')∘⍳ then I guess
 
last year's P6?
 
Yup.
 
ok, I see how that is built for dyadic iota underbar >_>
yes, bucket-command
 
@rak1507 Right, now find the equivalent left argument for instead of
 
something like '01ADGJMPTW' but that breaks for numbers
 
10:04 PM
22 in ⎕IO←0 but I don't think dyadic ⍸ is supposed to work like that?
 
10:23 PM
28 and only handles letters so far
wouldn't it be a hundred times easier to write a switch(){}
 
RGS
10:36 PM
@TessellatingHeckler that's already 10 bytes and you did nothing yet xD
 
@voidhawk Hard to tell without seeing your code. You can put it in a spoiler.
@rak1507 Right, so just add the remaining digits and do the 10| trick.
 
oh yeah
 
@TessellatingHeckler Uh, no, if one is familiar with then it can give some quite obvious solutions.
 
10|(⎕D,'AAADGJMPTW')∘⍸
 
Yesss!
 
10:46 PM
Neat
⍸ is pretty cool I need to use it more
 
Surely, that's easier than a switch(){}
 
you could write out in Python

if char in '1234567890':
char
elif char in 'ABC':
'2'
elif char in 'DEF':
'3'
in basically zero thinking
regarding that, I had tried ⍸ on characters and from whatever I found, thought it didn't work on them
and was heading down ⎕UCS and elsewhere
2+(26↑(4@5 7⊢10⍴3)/⍳10)[⎕A⍳⍵] for the letters
or that
 
Question 7 looks hard, I'm really bad at text formatting stuff
 
@TessellatingHeckler That doesn't even solve the problem fully, as you have to stick it in a loop and do an eval or something too. Maybe it doesn't require thinking, but it is a lot of code, and doesn't give the branch predictor a chance.
 
In python I'd use a dict probably, pretty simple to then do ''.join(map(d.get, string)) or whatever
 
10:51 PM
@rak1507 This isn't so much text formatting as it is a bit of mathematics plus some array mangling, all of which APL is good at.
 
Does apl have a repr type function where I can see quotes around strings?
 
@rak1507 ⎕SE.Dyalog.Utils.repObj
 
aha
 
^^^ is something i'd really like to see in something like ]box
 
nice thanks
↑ does add spaces! great
And yeah I assumed there'd be a ]box option for that
 
10:52 PM
@dzaima Yeah. I expect we'll do that once the array notation is implemented. I hope we can even make it ⍎⍣¯1
 
Would be nice
That would be really cool as well, the inverse function stuff is amazing
 
One problem is that some arrays cannot (easily) be represented as an expression.
 
@dzaima (these were 2 of my original p6 solutions)
 
@dzaima Special challenge for you is to find a 22-char ⎕IO←1 solution.
 
$text = '1DYALOGBEST*'
$nums = switch -regex ([char[]]$text) {
    '[01*#]' { $_ }  '[ABC]' { 2 } '[DEF]'  { 3 }
    '[GHI]'  { 4 }   '[JKL]' { 5 } '[MNO]'  { 6 }
    '[PQRS]' { 7 }   '[TUV]' { 8 } '[WXYZ]' { 9 }
}
-join $nums
laid out like the keypad, powershell switch loops because it was somebody's baby and they crammed all sorts of weird things into it
 
10:58 PM
@TessellatingHeckler How does this work for digits?
 
@Adám Sounds like J's 5!:5
 
@Adám it doesn't, make them [DEF3], [MNO6], [WXYZ9] etc. That's why Python is such a nicer language
 
@Bubbler Yeah, except it shouldn't need a named array. I guess using a name allows functions too…
@TessellatingHeckler Kind-of equivalent:
⋄ P6←'0' '1' '[2ABC]' '[3DEF]' '[4GHI]' '[5JKL]' '[6MNO]' '[7PQRS]' '[8TUV]' '[9WXYZ]'⎕S 3
P6 '1DYALOGBEST'
@DyalogAPL Hello?
 
@Adám should be possible to do a 2@ positions of ABC, 3@positions of DEF, but I can't imagine me getting that working with less than 50 tries
 
@Adám Right, it works with functions, and it gives the exact code used to define that name.
But Dyalog already has ⎕CR and ⎕NR for functions, so I guess the only thing we need is uneval on arrays
 
11:10 PM
It is almost impossible to write an APL expression e such that {⍵≡⍎e} for the array 1(⎕NS⍬)2
@Bubbler I.e. repObj
 
Ah, namespaces...
 
Not to mention other objects :-(
 
To me it's logical to disallow any array containing non-array objects, because objects can be stateful and therefore cannot simply be converted to code that evaluates to it
 
Right. Same with functions. repObj doesn't handle those either. However, Link does serialise namespaces, and even some functions.
@TessellatingHeckler In 19.0 or 20.0 we should be able to write:
(          '0'
 '1'      ⋄'[2ABC]'⋄'[3DEF]'
 '[4GHI]' ⋄'[5JKL]'⋄'[6MNO]'
 '[7PQRS]'⋄'[8TUV]'⋄'[9WXYZ]'
)⎕S 3
 
@Adám I recognise ⎕S as the regex substitute, what's the 3 at the end for?
 
11:20 PM
The pattern number in ⎕IO←0.
@TessellatingHeckler Actually, ⎕S is just Search, not Substitute. ⎕R is Replace.
 
Interesting (notice the lack of digits) solution using ⎕R:
⍎¨'z' 'z' '[ABC]' '[DEF]' '[GHI]' '[JKL]' '[MNO]' '[PQRS]' '[TUV]' '[WXYZ]'⎕R{⍕⍵.PatternNum}
 

« first day (1295 days earlier)      last day (1349 days later) »