Coming home from salsa dancing where I try not to break my legs to a video of Conor where I try not to overload my brain. Perfekt evening :)
@JamesSully2 жыл бұрын
I'm gonna have a crack at doing Advent of Code 2022 in BQN (starts in 4 hours) You should do it too so I can learn from your solutions!
@code_report2 жыл бұрын
I plan on posting a few videos 🙂
@JamesSully2 жыл бұрын
@@code_report nice!
@c4tubo2 жыл бұрын
Superb! I've been listening to all of the ArrayCast podcasts and been hungering for more of these videos from you. It would be especially nice to get more stuff on BQN since you have convinced me that it is the best array language to use.
@echoes6092 Жыл бұрын
I love this! I do feel like APL instructions tend to map to lines in other languages, somewhat (though of course instructions can be combined onto lines in other languages too, e.g. you can do 2 + 3 * 4 in almost every language). APL instructions are one character, and not counting the parentheses (since those probably wouldn't be necessary, splitting it up onto lines) the solution given in the video has 11 characters. APL definitely looks much more concise-and it is, for sure-but if you mapped the APL instructions to Python words, and added back in the necessary variables, you'd have a Python solution. What I love about APL most isn't the fact that the solution is 13 characters; what I love is that there's no redundancy.
@yarrowification2 жыл бұрын
Yess code report is back spreading the array gospel
@bighomem692 жыл бұрын
code report upload??? what a pleasant surprise!!
@gtdmg4892 жыл бұрын
I have a hunch that aliens might read this code easier than us.
@boredstudent94682 жыл бұрын
Just be obligatory reminder, that beeig verbose is not necessarily a bad thing. I much rather read in German than in Ithkuil. And i can mich easier comprehend what's happening in a Rust programm than Perl or even APL.
@arisweedler47032 жыл бұрын
This is an APL fan account, sir, please take your correct opinions about scalable software elsewhere (jokes aside the obligatory reminder is received and respected) Terse code can be fun, and more truthful than verbose. Bad code is the real only enemy
@boredstudent94682 жыл бұрын
@@arisweedler4703 i know it is, and i kinda love it, thats why it's just the reminder not a rant essay. Sometimes i just need a little anger outlet.
@lucastavano42882 жыл бұрын
It's also nice to add that good code is always code that is maintainable, following clean code principles, when working in big companies, it's always good bein verbose when you gain simplicity with it, making other devs comfortable to maintain and improve your code. Just as a reminder that we don't write code for ourselves, but actually for other devs to be able to maintain and grow our codebase ☺️
@soyitiel2 жыл бұрын
Reminds of another code_report video about a problem with two apl solutions, one slightly less "verbose" than the other, but also less performant. There's beauty and ungliness in both sides. Both ends can either make it easy on the eye and mind, but also they can obscure everything. Maybe, like in most things in life, the key is balance
@darcy66982 жыл бұрын
unless u go the other extreme .... toki pona
@abrudz2 жыл бұрын
In BQN you can use the Cells 1-modifier instead of Rank 1.
@code_report2 жыл бұрын
Oops, I forgot 🙃
@NikolajLepka2 жыл бұрын
Yeah I was thinking the same thing
@ancbi2 жыл бұрын
While I have heard about APL, I still the title as a 'I love apple and bacon'.
@Evan490BC Жыл бұрын
BQN is bad for you. Too much potassium nitrate and salt.
@PEGuyMadison2 жыл бұрын
Do you have recommendations on learning APL? I am on MacOS so it has to work on that platform.
@TagetesAlkesta Жыл бұрын
Bro really pulled out the standard galactic alphabet for this one
@cusaint3596 Жыл бұрын
It will be great if you or someone provide separate tutorials on how to use BQN, J, and APL for very beginners. I would find more useful to learn how to install the programs and how to use each command (explained in a series of videos), and then some basic demonstrations/samples. That means: from zero to intermediate to advanced. The ones you are currently providing are advanced.
@code_report Жыл бұрын
I have a getting started video with APL: kzbin.info/www/bejne/m3Kmq6iHfNVmjNk
@cusaint3596 Жыл бұрын
@@code_report Thank you, but that one is to install Dyalog on Ubuntu. It would be nice to have a tutorial specific to BQN that shows how to install it on Windows and the explanations on at least the most important commands. I did not find BQN tutorials on KZbin that show the basics of BQN.
@cusaint3596 Жыл бұрын
@@code_report Thank you for the getting started video with APL, but that one is mainly about how to install Dyalog in Ubuntu and only a few commands. I have not found a KZbin tutorial that shows the basics of BQN: How to install it in Windows, what editor is most recommended to type the commands, and an explanation of the commands specific to BQN. The same for J. Yes, I can visit websites related to those, but it will be nice to have KZbin videos that actually show how.
@kacperuminski15472 жыл бұрын
It's been 84 years...
@billr30532 жыл бұрын
Negating the entire boolean array and then re-summing everything seems inefficient. You would get the same result by simply subtracting the row and column sums from their axis lengths. Incorporating that shortcut into the final outer product cleverly may in fact eliminate the need for outer product, I think. Also, in my opinion, the problem statement is needlessly obscure and difficult to follow. It’s like they’re trying too hard to not give away obvious candidate algorithms.
@_tsu_ Жыл бұрын
Well, the whole expression should be optimised out into a single pass algorithm before execution so it's all good.
@0LoneTech6 ай бұрын
Something like this? +⌜´ ((2×+´)-≠)˘¨ ⋈⟜⍉ grid Take both the matrix and its transposition, subtract the axis length from twice the sum (since each 1 is a missing 0 also), and make a sum table from those two vectors.
@585ghz2 жыл бұрын
😲 wowww Nice solution!!!
@lucaayfmlyysiaejdsrtnnervd4646 Жыл бұрын
I don't understand a character that's there, but it's BEAUTIFUL!
@davidprock904 Жыл бұрын
If I don't know bqn or apl, and I learn bqn first, would there be any need to learn apl? Didn't bqn come from apl? Does apl offer something that bqn doesn't??
@mumujibirb Жыл бұрын
nice language and solution but the syntax uses goofy ahh symbols, which are nice in a way but hard to convey their meaning
@arraymac227 Жыл бұрын
Is BQN just a transliteration of APL, or of J for that matter?
@0LoneTech6 ай бұрын
No. There are differences in features like first class functions, role conversions, namespaces, affine characters, leading axis model, how to overlap shared glyphs, etc. But they probably share considerably more.
@vaaaaaas2 жыл бұрын
Less is more. Flatter is better. Unicode thighs save lives.
@spacelem2 жыл бұрын
My Julia code was "solution = sum(X, dims=1) .+ sum(X, dims=2) .- sum(X.==0, dims=1) .- sum(X.==0, dims=2)", but I'm not sure if I can reduce that any further. Weirdly I tested it with a 100x100 matrix and that version seems to scale better than the longer fully looped version (going from 6.5x slower with the 3x2 matrix to 74x faster).
@nunzioturtulici9636 Жыл бұрын
I like Julia too [sum(v+w) for v ∈ eachrow(2X.-1), w ∈ eachcol(2X.-1)] (actually one should use a let to avoid computing twice 2X-1)
@IantoCannon Жыл бұрын
Code golf is the best golf
@H2CO3Szifon2 жыл бұрын
This is all nice and everything, but a NumPy-based Python solution would be a two-liner and a **ton** more readable (and anyone doing serious matrix manipulation in Python would use NumPy anyway): y = 1 - x diff = np.add.outer(x.sum(axis=1) - y.sum(axis=1), x.sum(axis=0) - y.sum(axis=0))
@romaing.15102 жыл бұрын
Easily readable one liner numpy solution (as it is always possible): 2 * (grid.sum(axis=0) + grid.sum(axis=1, keepdims=True)) - sum(grid.shape)
@jamieg24272 жыл бұрын
how dare you offend the (actually surprisingly sizeable) hoards of bqn-invested children.
@semurgx Жыл бұрын
beautiful, but not readable who cares!?
@torarinvik49202 жыл бұрын
If you want an extra challenge, try solving it in Prolog
@jayantchoudhary14952 жыл бұрын
why, seems pretty straightforward?
@torarinvik49202 жыл бұрын
@@jayantchoudhary1495 I don't know if you actually have used it or not. But Prolog is so limited and imo difficult, it's probably one of the few languages where making a compiler and interpreter for it would be easier than actually learning how to properly use it. I might not have enough experience with Prolog to be a proper judge but for me at least it's difficult and frustrating even for trivial tasks.
@jayantchoudhary14952 жыл бұрын
@@torarinvik4920 oh i have used it to solve may of the previous years advent of code problems. The problem usually is execution speed as I am still not good at optimization. For this particular problem just 1)take row wise and column wise sum (with accumulate) 2)subtract n from it ( from the n by n grid provided) to get sum of zeros 3) plug the formulas it's done.
@torarinvik49202 жыл бұрын
@@jayantchoudhary1495 Nice :)
@bzboii2 жыл бұрын
For some reason the algorithm (™) chose not to present me this video but I’m very happy I found it now! code_report Leetcodes are back bb!
@steveAllen01122 жыл бұрын
This works, too: -⍥(+/∘.++⌿)∘~⍨ Basically, pass the argument to both tines of the fork, preprocessing the right side with negate.