Programming Leftovers
-
AdventOfCode ☛ Advent of Code 2023: Day 2: Cube Conundrum
Determine which games would have been possible if the bag had been loaded with only 12 red cubes, 13 green cubes, and 14 blue cubes. What is the sum of the IDs of those games?
-
James Koppel ☛ Should you split that file?
So now we know that, just by recording a little bit more of your thinking when writing code, it’s possible to have files which are both large and well-organized. And doing so lets you read code faster, follow control-flow better, delay having to find good names, and literally injects happiness into your life. Let’s make our files large again!
Of course, this is still not the easiest thing you can do to lower the cost of large files.
-
Uwe Friedrichsen ☛ Software - It's not what you think it is - Part 1
The current AI hype is accompanied with a lot of predictions that software development will be taken over by AI solutions soon and most software developers will lose their jobs together with most other white collar workers. While I agree that AI solutions will have a significant impact on software development, I disagree with the notion that software development will be taken over by AI solutions anytime soon.
Based on my observations, this narrative is strongest among people who do not really understand software and what it means to create software. To be a bit provocative: I think, it will be a lot easier to replace each highly paid manager who eagerly awaits to replace all their software developers than to replace the software developers they want to get rid of. I mean, most of those managers act in very predictive ways, not showing any signs of actual creativity. Software development on the other hand is a different story.
Putting provocations aside: What do I mean with that?
From all I see, most people do not understand software and software development at all. Especially, most fail to understand the following five misconceptions regarding software: [...]
-
AdventOfCode ☛ Advent of Code: Day 1: Trebuchet?!
The newly-improved calibration document consists of lines of text; each line originally contained a specific calibration value that the Elves now need to recover. On each line, the calibration value can be found by combining the first digit and the last digit (in that order) to form a single two-digit number.
-
Sean Conner ☛ Unit testing from inside an assembler
"Plug plug: I've written an assembler[0] for the 6502 (with full LSP and debugging support). It also supports the concept of unit tests whereby your program gets assembled and every test individually gets assembled and run, whereby you can add certain asserts to check for CPU register states and things like that."
-
Perl / Raku
-
Rakulang ☛ Day 2 – An update on raku.land
A couple of years ago we gave a talk at the The Raku Conference 2021 which served both as an announcement and an introduction of raku.land. It was an exciting time for us, since it was the first time we were officially addressing the community, and we were keen to see how our work would be received and what impact it would have.
Fast-forward to today, and some of you might have noticed that the venerable modules.raku.org domain now redirects to raku.land.
We thought this was a good chance to take a look at what lead us here, where the new site is, where it is going, and how you—yes, you!—can help get it there.
-
Perl ☛ Perl Advent Calendar 2023: Santa tackles Bitcoin, part one
It quickly became obvious the new task couldn't be performed in the current modus operandi. The Elves were used to crafting everything themselves and often resorting to magic in their toy factory. They can't counterfeit Bitcoin - not because it's a bad thing to do, but rather because it's impossible. Even the strongest Elf Magic won't do. They could either try to mine it or obtain it by providing high quality goods and services on the market. Luckily, one of the elves remembered he had played with Bitcoin back in 2011 and still had the old hard drive, from which they were able to reclaim keys to 50 bitcoins, enough for a big juicy present for a lot of kids. The unspent transaction ID for their coins is a4e407ba6b54106e4bd209704666a2b541b9b03d04ef8cb779aafe18238744e1.
-
-
Python
-
Ivan Sagalaev ☛ Python stdlib gems: collections.Counter
Here's a toy problem. Given a corpus of phone numbers for different countries determine a most prevalent display format in each country and use it to re-format an arbitrary phone number for its country. For example, if most US numbers in our data corpus are written like xxx-xxx-xxxx then the string (206) 1234567 should be converted to 206-123-4567.
For simplicity, let's assume that all numbers are local so we don't have to deal with the complexity of international prefixes.
-
Armin Ronacher ☛ Untyped Python: The Python That Was
But hear me out: all the arguments against dynamic languages and dynamic typing systems were already there! Nothing new has been invented, nothing really has changed. We all knew that there was value in typing, and we also all collectively said: screw it. We don't need this, we do duck typing. Let's play this to our advantage.
Here is what has changed: we no longer trust developers as much and we are re-introducing the complexity that we were fighting. Modern Python can at times be impossible to comprehend for a developer. In a way in some areas we are creating the new Java. We became the people we originally displaced. Just that when we are not careful we are on a path to the world's worst Java. We put typing on a language that does not support it, our interpreter is slow, it has a GIL. We need to be careful not to forget that our roots are somewhere else. We should not collectively throw away the benefits we had.
-
-
Shell/Bash/Zsh/Ksh
-
University of Toronto ☛ The Unix V6 shell and how control flow worked in it
On Unix, 'test' and '[' are two names for (almost) the same program and shell builtin. Although today people mostly use it under its '[' name, when it was introduced in V7 along side the Bourne shell, it only was called 'test'; the '[' name was only nascent until years later. I don't know for sure why it was called 'test', but there are interesting hints about its potential genesis in the shell used in V6 Research Unix, the predecessor to V7, and the control flow constructs that shell used.
(This shell is sometimes called the Mashey shell, but the version you can find described in Wikipedia as the 'PWB shell' is rather more elaborate than the V6 sh manual page describes or the V6 sh.c seems to implement.)
-