« first day (1771 days earlier)      last day (867 days later) » 

12:04 AM
↑ v1¨ (v1 m)
┌→────────────────────────────────┐
↓ ┌→────┐ ┌→────┐ ┌→────┐ ┌→────┐ │
│ ↓1 2 3│ ↓7 4 1│ ↓3 6 9│ ↓1 4 7│ │
│ │4 5 6│ │8 5 2│ │2 5 8│ │2 5 8│ │
│ │7 8 9│ │9 6 3│ │1 4 7│ │3 6 9│ │
│ └~────┘ └~────┘ └~────┘ └~────┘ │
│ ┌→────┐ ┌→────┐ ┌→────┐ ┌→────┐ │
│ ↓3 6 9│ ↓1 2 3│ ↓9 8 7│ ↓3 2 1│ │
│ │2 5 8│ │4 5 6│ │6 5 4│ │6 5 4│ │
│ │1 4 7│ │7 8 9│ │3 2 1│ │9 8 7│ │
│ └~────┘ └~────┘ └~────┘ └~────┘ │
│ ┌→────┐ ┌→────┐ ┌→────┐ ┌→────┐ │
│ ↓7 4 1│ ↓9 8 7│ ↓1 2 3│ ↓7 8 9│ │
│ │8 5 2│ │6 5 4│ │4 5 6│ │4 5 6│ │
got it.. nice.
It seems to me not possible to use outer product ∘.∘
 
It doesn't make so much sense here. Outer product is all about combining two elements of arrays at a time. Here, you want to combine two functions at a time. It can be done using one of those methods I linked to, but it only complicates matters.
 
Yep, make sense. Now, we can see the power of APL, image try generate such tables on Java or Python..
 
@elliptic00 Like this: n←⎕NS¨⍬⍬⍬⍬ ⋄ n[1].F←⍉ ⋄ n[2].F←⌽ ⋄ n[3].F←⍉ ⋄ n[4].F←⊢ ⋄ ∘.{⍺.F ⍵.F m}⍨n
 
@Adám, I need time to digest it.. first... :).. awesome :)
it is not that bad..
⍬⍬⍬⍬ what is that?
 
Four empty lists.
 
12:16 AM
⍴ ⍬⍬⍬⍬
┌→┐
│4│
└~┘
⍴ ⍬
┌→┐
│0│
└~┘
      ⍴ (⍬⍬)
┌→┐
│2│
└~┘
      ⍴ (⍬⍬⍬)
┌→┐
│3│
└~┘
where is 1 ?
⍴ (⍬)
┌→┐
│0│
└~┘
      ⍴ (⍬⍬)
┌→┐
│2│
└~┘
      ⍴ (⍬⍬⍬)
┌→┐
│3│
└~┘
      ⍴ (⍬⍬⍬⍬)
┌→┐
│4│
└~┘
 
Parentheses do not enclose.
So ⍴⍬ gives the shape of the empty list, which is 0.
 
⍴ ⍬⍬
┌→┐
│2│
└~┘
⍴ ⍬⍬
┌→┐
│2│
└~┘
⍴ 1
┌⊖┐
│0│
└~┘
      ⍴ 1 2
┌→┐
│2│
└~┘
 
@elliptic00 tio.run/##PYzLCsIwEEX3/… not so bad :P
 
Ic,
@rak1507, nice, Python has very similar functions like Haskell. But Java, it might a bit more code, there is no zipWith in Java Lambda..
 
yeah, doing it in java sounds painful
zip(*foo) is nice but ⍉foo is nicer
 
12:26 AM
when come to this kind of question, APL is unbeatable :)
 
yeah, especially if it was then extended to 3d or something
 
@elliptic00 Except by BQN: Try it!
 
wow, BQN is much more cleaner than APL..
 
Well, yes, the whole goal of BQN is to be a cleaner APL, based on half a century of experience.
 
having an array of functions there is useful
 
12:30 AM
And being able to switch role so easily.
 
cleaner and easier to understand.. I think Dyalog should take note.. what can they learn from BQN
do you guy think Dyalog is too conservative for the development APL ?
 
@elliptic00 Uh, much of BQN was originally developed in-house at Dyalog.
@elliptic00 You may want to read this blog post which discusses Dyalog's stance on moving quickly.
 
They should run the company like Google, FB, or spaceX, move fast, if something breaks, fix it..
 
@elliptic00 Are you serious?
 
12:47 AM
:)... I mean they should build more tools around the array language ecosystem, so new user can try and test.. without any programming experience...
 
What kind of tools do you have in mind?
 
e.g. running apl as script language is no braining important for development. I'm not sure why take so long to do so. It might be technical challenging that I don't not understand obviously..
18.2 will be ..:)
 
Early 2022.
 
Yep..
BQN is completely open source language?
like C++, or Python?
 
Yes, there are multiple implementations and they're all open source so far
 
12:54 AM
the best way to expose your language to more people is to let people to have fun with your language.
 
OK, so how do you suggest we do that with APL?
 
I remember no long ago, I try to download Dyalog APL (I have no idea what is RIDE. what is APL, what is array language at that time), But Dyalog ask me to register an account in order to download them.. I just give up... and late..... Dyalog allow ppl to download RIDE.. without any account... I think..
 
OK, so we fixed that, as you no longer need to register to download the unlimited product.
 
The document is too out dated in Dyalog website.., It is very hard to understand it for people like me with no experience.
Right now I use above site to learn APL.. it is very easy to understand..
The fact is there is not too many resource online.
 
@elliptic00 Anything in particular you found to be out of date? (I do recognise that what's on our website is neither welcoming, nor good learning material – our new website is in the works.)
@elliptic00 Wait, are you aware of the learning materials page on APL Wiki?
 
1:08 AM
Yep, the APL Wiki is pretty good actually, I use all the time
APL is "hard" language for ppl who are from C++/Java/Python world at the beginning.
2
 
Yes. Much easier to teach to non-programmers.
2
 
Maybe..
APL is the language "make your think differently"
 
Yes.
 
 
4 hours later…
4:57 AM
^ what? (on RIDE, pressed Ctrl+UpArrow in a session)
 
 
2 hours later…
6:39 AM
@Marshall I was checking out BQN. The docs are nice and I especially appreciate this page: mlochbaum.github.io/BQN/doc/fromJ.html. One piece of info I'd love to see: "things BQN is better at" -- examples of specific problems that are awkward to handle in J but which BQN handles gracefully. If you have anything off the top of your head you can share here, that would be helpful too.
I did notice having ‿ instead of spaces for stranding allows you to avoid parens, which eg are required in J when a numeric rank operator is adjacent to a list. That one feels minor though, and I know there are deeper things BQN fixes.
 
7:02 AM
@elliptic00 it should be an easy language to anyone that had some training in mathematics, because I find that the language is like applied abstract algebra.
 
7:29 AM
@PyGamer0 Can confirm I can reproduce - probably some crud getting interpreted as Unicode when generating the error message, but I reckon must be related to Edit → Preferences → Shortcuts
Indeed, TL is "Toggle Localistation"
which is only relevant in the editor
I'll log an issue
 
I can also reproduce, Ctrl-Shift-J (JBK) produces a similar error
 
yeah and Ctrl+Alt+C
 
Also big fan of your videos, Rikedy :)
 
@FawnLocke Thanks - I think I thould make more but combination of not sure what to cover and lack of time
or maybe I'm just making excuses ;)
advent of code seems like low hanging fruit at first, but it'll just be embarassing when it comes to the later problems
 
Haha, yeah. Content production is tough! I remember hearing about how John Scholes would labour over a single video for months.
And totally, the majority of us struggle with those later problems :)
Plenty of challenges out there to complete with the "ancient runes" lol. I preferred your more educational videos, on modern features & optimisation in APL (Love the font you use btw, currently using it system-wide)
 
8:02 AM
Advent of Code 2021 has begun, and it kicks off with an APL-banger. Right up our street.
 
+1 if you didn't use 3+/ in part 2 :)
 
@xpqz looks interesting, thanks for the shoutout :)
not sure if I feel comfortable enough to join with APL. But then, it'd be a good opportunity to get better.
 
@milia It's a perfect way to learn, trust me -- the ramp-up is gentle.
 
@xpqz thanks :) I'll go with APL then, having your book side by side as a reference :D
 
@Bubbler does 3+⌿ count? :P
 
8:06 AM
Many people try using a new language for AoC to learn it
 
@rak1507 can we use your leaderboard?
 
@Bubbler so i dont get +1 :/
actually i feel that my program is dumb
 
 
1 hour later…
9:40 AM
whats the best way to do something like (1 <op> 2) (2 <op> 3) (3 <op> 4) when i give <op> and 1 2 3 4
 
⎕←2,/⍳4
 
@FawnLocke
┌───┬───┬───┐
│1 2│2 3│3 4│
└───┴───┴───┘
 
Windowed reduce
⋄ ,{2⍺⍺/⍵}1 2 3 4 ⍝ Does this answer your question?
 
@FawnLocke
┌───┬───┬───┐
│1 2│2 3│3 4│
└───┴───┴───┘
 
ah i am dumb :/
⋄ <{2⍺⍺/⍵}⍳10
 
9:45 AM
@PyGamer0 1 1 1 1 1 1 1 1 1
 
@xpqz hm? what? ofc
code is 656501-67f7cded if anyone else wants it
@Bubbler what'd you use?
 
You can use ⌺ and ⌽
Couldn't think of anything else
 
presumably it's using the fact a+b+c<b+c+d is the same as a<d
 
yeah
 
+/<⌿a[↑¯3 3↓¨⊂⍳≢a]
 
9:57 AM
Nice :)
 
1-⍨+/<⍥⊃∘⌽⍨⍤⊢⌺4⊢a
 
Bubbler's: +/3∘⌽>⊢
 
doesn't work in general
 
Yeah
 
Yeah, I said it's cheating in the other chatroom
 
10:01 AM
ah
 
10:28 AM
Package manager, newline in string literal, ndarray literal, apple silicon support
Julia 4 - 0 APL
 
yeah... I wonder how julia is funded
 
@rak1507 maybe, MIT ?
@Bubbler :'(...APL will get there eventually...
 
10:56 AM
should i share my apl solution here?
 
Share as a link,
 
@PyGamer0 for the advent of code ?
 
@PyGamer0 yeah as a link
 
ok
lemme make a gh repo
 
I ported my APL solution to numpy. Iverson must be turning in his grave: gist.github.com/xpqz/151a8aa81f5333da9d3d75bb2bb48fee
2
 
10:57 AM
lol
 
*a,=map(int,open(0))
print(sum(i<j for i,j in zip(a,a[1:])))
print(sum(i<j for i,j in zip(a,a[3:])))
 
Cheating.
 
My apl solution.
 
mine., There's an obvious couple character solution to part 1, but I'll just leave up my initial thoughts
 
My k version
 
+/'3'd can be 3+/':d (n'x is removed in the latest version)
 
@PyGamer0 for small things also gist is nice :)
 
 
1 hour later…
12:39 PM
@Jonah A recent example was an outer product ("table") of functions. See from this message and until I show the BQN solution.
 
12:49 PM
@Jonah Right, I've been thinking about extending the why BQN? page with some language-specific comparisons. Relative to J you get garbage-collected closures and namespaces, painless Unicode handling, the based array model (comparison), and somewhat better trains and combinators (no @ versus @: annoyance; 2-train is atop; ⊸⟜ are really nice).
 
@Marshall And proper, non-hacky, first-class functions.
 
Right, I left that out since you'd already mentioned it.
And multi-line array notation is a nice benefit too.
 
1:18 PM
Hello all! I just started learning APL and want to do Advent of Code in it (as I see many ppl here are doing :)). I think I have a good understanding of the basics, but one thing I'm totally missing is how do I read in and parse a file?

I'll look at others' solutions, but what resources should I look at first? Say, how do I read a file with a bunch of numbers per line into a vector of (boxed) vectors?
 
@klao Welcome! Which APL are you using?
 
These are my solutions for today's AoC, btw:

day01a ← +/2</⊢
day01b ← +/2</3+/⊢
@Adám Dyalog
 
@klao If each line has the same number of numbers, you should be able to use ⎕CSV.
@klao Btw, when you have some minutes, have a look at apl.wiki/APL_Orchard#Features for some tips on this room, including how to format code properly.
 
@Adám Will do, thanks!
 
@klao Isn't there only one number per line?
 
1:25 PM
@Adám In today's problem yes, but who knows what tomorrow will bring. Want to be prepared :)
 
Ah, I see. For general file reads, have a look at ⎕NGET. Also, are you familiar with APLcart?
 
@Adám I have discovered the APLcart, yes. It is a bit intimidating, though. :) But yeah, I had some fun decipher a few things from it. I haven't though to look for i/o thing in there…
 
Well, now you have :-)
 
1:45 PM
@klao ⍎¨lines
 
@rak1507 Thanks, I found it in your gist above!
@rak1507 This wouldn't work for negative numbers, right? I have to replace minuses with high minuses first
 
yea, because ⍎ is exec and '1 2 3 4 5' is a valid array it'll work on that too
@klao true, for that ⎕CSV might be better
 
2:04 PM
@klao This is how I read and converted the AoC data today: ⍎¨⊃⎕NGET'../d/1'1
 
@xpqz Thank you! Same as @rak1507
 
But it is literally numbers in a text file, right?
 
@FawnLocke You can't link like that.
 
@Adám Yes.
 
2:07 PM
@xpqz Btw, why do you use 1⊥ instead of +/ in your solution?
 
I can't?
 
@Adám Thanks, found it now!
 
@FawnLocke No, it gives Puzzle inputs differ by user. Please log in to get your puzzle input.
 
Ah okay.
 
@klao Habit. But it's faster, and easier in tacit phrases, as it's not using an operator.
 
2:09 PM
@xpqz Interesting. And it has a left argument, which makes trains easier. Will remember it.
 
 
3 hours later…
5:14 PM
@Adám Hey @Adám! I'm sorry I didn't reply earlier, I'm actually not familiar with the StackExchange Chat.
I am indeed interested in APL. I'm currently attempting AdventOfCode in APL and in C (mostly to avoid being extremely frustrated hahaha)
 
@PatrickVillela I can recommend xpqz.github.io/learnapl :)
 
Yes, xpqz's book and APL Cultivation are the ticket to success :)
 
5:30 PM
@xpqz Thanks @xpqz and @FawnLocke. I've actually started reading both resources, as well as Mastering Dyalog APL. I'm tending to continue using yours, @xpqz. I found it works better for me.
 
@PatrickVillela That makes me happy to hear, thank you.
@PatrickVillela I gave a presentation at the Dyalog '21 conference talking about it: dyalog.tv/Dyalog21/?v=qrWCYPFfsCU
 
@xpqz Oh, that's you! That's awesome! I'm actually halfway through that presentation. I'm somewhat drinking from a firehose here, but that's really fun! Thank you and the people here for keeping APL alive!
Is there some place where we can discuss AdventOfCode improvements without spoiling it?
 
There's the Discord server, we've been posting solutions there.
 
We used this chat last year, certainly.
 
https://aplwiki.com/wiki/Forums

Feel free to ask questions or for improvements and you'll get a hoard of people willing to show you how good at APL they are :P
 
5:42 PM
Hahaha thanks a lot y'all. I'll go there!
 
6:03 PM
@PatrickVillela Welcome. No pressure. If you're not so familiar with SE Chat, have a look at aplwiki.com/wiki/APL_Orchard#Features
You'll find that the crowds in the APL Orchard and on the APL Farm have some overlap, but the culture differs.
 
 
3 hours later…
8:37 PM
@xpqz I don't understand your solution to the part two. Why don't you need to take 3-windows sum?
 
8:55 PM
@xpqz Now I get it. Two element are the same ones so you can compare just the different one. This is a really nice way to learn from wiser people. ;)
 
9:53 PM
I can’t really take credit for that insight - @rak1507’s Python code above does the same.
 
10:40 PM
have to say I'm surprised how few people have used the fact a+b+c<b+c+d is equivalent to a<d: in APL 3+/ is so easy I just did that anyway, but in other languages I've seen people building up a list of slices with for loops etc when it would be much simpler to do it the other way
 

« first day (1771 days earlier)      last day (867 days later) »