No, it is just boring to cover. It boils down to mapping 9 combinations of ABC & XYZ to values 1 to 9 and then adding them up. See here: github.com/codereport/Advent-of-Code-2022/blob/main/day02.apl
Dyalog APL is decended from the first APL. It's got a lot in it but it does some things in a odd way, some glyphs use leading axis array theory, others use tailing access, some funkyness with / acting as both a function and a modifier, and some things like that. In contrast BQN is much newer, being only about 2 years old. It's a lot more predictable I find and has already found a stable base. Generally its APL that more consistant and a bit more modern (its got first class functions and a couple other goodies). I perfer BQN but that doesn't mean APL is a slouch.
There is the tutorial on BQN's website which is pretty alright, I mainly learnt by doing a bit of the tutorial then trying out to figure out solutions for code challenges and reading up on each of the primatives. After a bit I tried to make a project in BQN and that really cemented it in my mind. Some other advice: keep a notes file on neat bits of code you write or run into, write down how it works; study other peoples code, I'm often surprised at a brand new way of something I thought I had fully groked; talk to people about it and show off your own code, there is a discord/matrix room you can join to chat shop. Beware though, some people there could use some reigning in, ignore them. A couple of newbies have joined recently so it's a good spot to look at what others are struggling with and solutions to those issues, I try to help around there when I'm on and a couple others do as well. Happy Array programming!
@@cranknlesdesires Thank you. Im basically studying many languages, as I have a hobby of making my own interpreters, or at least Im in the process of doing so. I need to get experience of as many languages as I can. It is kinda sad that all languages just copy eachother and they all look the same. Only languages like APL,Forth,Smalltalk family,Prolog, Basic, ML family and a few others tried to re-invent the wheel. I've seen a new language now though that is made for data science I believe that focuses on syntax more or less only for arrays. It is pretty original and it seems as an attempt to beat Fortran at it's own game. I can't remember the name but I believe it is made by the industry for doing real work.
I would actually really like an attempt in BQN at parsing the data, it's really what I am stuck on. There's no primitive for Partition in BQN and so I can't figure out a nice way to approach it.
Agreed, this was the hardest part for me as well. Understanding the idiomatic way to convert plaintext data into ideal formats for BQN in the form of arrays would be really beneficial for people learning the array languages, since the manipulation and analysis of the fully parsed data is usually the main focus in these videos.
BQN has a dedicated sort glyph? Get out! I think I might give BQN a try just because of that :) I've paused your video before seeing part 2 and tried it myself -- stumbled upon the issue with "take 3" and found ⟜ (as opposed to your ·). I'll have to check those out in more detail, as well as the differences in the parsing algorithm. Thankfully the documentation is pretty good!
It has two sorting glyphs! sort up ∧ and sort down ∨ and it's also got glpyhs for getting the sorting permutation, say if you want to sort one list by another related one ⍒⍋
Your APL sort train is not actually shorter than just a function that indexes ω on its sorted version. It’s always annoying making a train with ⌷ because you need that enclose…
What Conor mentions about Dyalog 19.0 (it'll not make it until a version after that, but that's besides the point) is a Select function ⊇ which avoids that enclosure, and also a Behind operator ⍛ which provides a Hook combinator, and thus allows writing both Sort and "Sort By" (actually "Sorts") as ⍋⍛⊇
To me the hardest part of aoc in array langs is always parsing the text.
I always look forward to your videos.
Nice. BQNpad looks incredible too. Why not do day 2? Is it clunky in APL?
No, it is just boring to cover. It boils down to mapping 9 combinations of ABC & XYZ to values 1 to 9 and then adding them up. See here: github.com/codereport/Advent-of-Code-2022/blob/main/day02.apl
@@code_report Thanks, Connor.
What is the difference between APL and BQN? Where can I learn the basics of this language?
Dyalog APL is decended from the first APL. It's got a lot in it but it does some things in a odd way, some glyphs use leading axis array theory, others use tailing access, some funkyness with / acting as both a function and a modifier, and some things like that. In contrast BQN is much newer, being only about 2 years old. It's a lot more predictable I find and has already found a stable base. Generally its APL that more consistant and a bit more modern (its got first class functions and a couple other goodies).
I perfer BQN but that doesn't mean APL is a slouch.
@@cranknlesdesires Do you know some good tutorials on how to get started with BQN?
There is the tutorial on BQN's website which is pretty alright, I mainly learnt by doing a bit of the tutorial then trying out to figure out solutions for code challenges and reading up on each of the primatives. After a bit I tried to make a project in BQN and that really cemented it in my mind.
Some other advice: keep a notes file on neat bits of code you write or run into, write down how it works; study other peoples code, I'm often surprised at a brand new way of something I thought I had fully groked; talk to people about it and show off your own code, there is a discord/matrix room you can join to chat shop. Beware though, some people there could use some reigning in, ignore them. A couple of newbies have joined recently so it's a good spot to look at what others are struggling with and solutions to those issues, I try to help around there when I'm on and a couple others do as well.
Happy Array programming!
@@cranknlesdesires Thank you. Im basically studying many languages, as I have a hobby of making my own interpreters, or at least Im in the process of doing so. I need to get experience of as many languages as I can. It is kinda sad that all languages just copy eachother and they all look the same. Only languages like APL,Forth,Smalltalk family,Prolog, Basic, ML family and a few others tried to re-invent the wheel. I've seen a new language now though that is made for data science I believe that focuses on syntax more or less only for arrays. It is pretty original and it seems as an attempt to beat Fortran at it's own game. I can't remember the name but I believe it is made by the industry for doing real work.
I would actually really like an attempt in BQN at parsing the data, it's really what I am stuck on. There's no primitive for Partition in BQN and so I can't figure out a nice way to approach it.
Agreed, this was the hardest part for me as well. Understanding the idiomatic way to convert plaintext data into ideal formats for BQN in the form of arrays would be really beneficial for people learning the array languages, since the manipulation and analysis of the fully parsed data is usually the main focus in these videos.
i demand a J solution! :)
ask and ye shall receive. would love if someone could tell me how to parse the input better.
getData =: {{ {{; ". each y }} each
BQN has a dedicated sort glyph? Get out! I think I might give BQN a try just because of that :)
I've paused your video before seeing part 2 and tried it myself -- stumbled upon the issue with "take 3" and found ⟜ (as opposed to your ·). I'll have to check those out in more detail, as well as the differences in the parsing algorithm. Thankfully the documentation is pretty good!
It has two sorting glyphs! sort up ∧ and sort down ∨ and it's also got glpyhs for getting the sorting permutation, say if you want to sort one list by another related one ⍒⍋
Your APL sort train is not actually shorter than just a function that indexes ω on its sorted version. It’s always annoying making a train with ⌷ because you need that enclose…
What Conor mentions about Dyalog 19.0 (it'll not make it until a version after that, but that's besides the point) is a Select function ⊇ which avoids that enclosure, and also a Behind operator ⍛ which provides a Hook combinator, and thus allows writing both Sort and "Sort By" (actually "Sorts") as ⍋⍛⊇
@@abrudz Thank you for the explanation :)