news
Programming Leftovers
-
Giles Turnbull ☛ gilest.org: Working in the open ≠ comms
This is a topic that’s come up a lot in recent conversations, and that usually means it’s worth writing down.
I have a hypothesis: “working in the open” is not the same as “comms”.
They overlap, and they’re often done by the same people and teams, and they often have similar effects and consequences. But the difference lies in the intended purpose.
-
Rlang ☛ Repost: ctrlvee: Extract external R code and insert inline
Ever find yourself looking through a pkgdown page or a Quarto book, copying and pasting code chunks from your browser into your IDE? I do, and it’s a minor annoyance.
My friend and colleague VP Nagraj published a new R package called ctrlvee that makes this a lot easier.
-
Andrew Nesbitt ☛ Dependency Pruning
The best time to prune your dependency tree was three years ago. The second best time is right now.
Every package in your lockfile is a door someone else holds the key to. Install scripts run on your CI with whatever credentials your CI has, the maintainer’s account can be phished or the registry entry handed to a new owner, and the next patch release can be something quite different from the last one. A dependency you stopped calling two refactors ago is exposed to all of that exactly as much as one you hit on every request, and you still get paged when a CVE lands in it. The cheapest supply-chain hardening you can do is to stop supplying yourself with things you don’t use.
-
SICP ☛ I keep bouncing off the Scheme language | Structure and Interpretation of Computer Programmers
My difficulty is with thinking the way that lets me write Scheme. I have the ALGOL neurotype. When I think about a programming problem, I think in terms of the sequence of instructions I need the computer to do, and the memory locations that can hold the information the computer needs to track. After decades of working with OOP, I can quickly identify smaller computers that run smaller programs to make it easier, but only because I’ve got experience using the Simula-derived, neurologically ALGOL-based OOP strands like Java and Smalltalk-80.
-
Daniel Lemire ☛ Only 17% of all 64-bit Integers are products of two 32-bit integers
In software programming, the product between two integers is often computed to a fixed number of bits with overflow. Consider 8-bit integers. If you multiply 127 by 127, you get back the number 1 as an 8-bit unsigned integer, with an overflow. The actual full product is 16129. To represent 16129, you typically use 16 bits of precision.
Thus we have the notion of the full product. The full product of two 32-bit integers is typically represented using 64 bits. The question that preoccupied me is what fraction of all 64-bit integers can be written as the product of two 32-bit integers.
You might wonder why you would care?
-
Rlang ☛ Functions over Idioms – Writing R in Python with rfuns
If you’ve read any of my past posts you know I like to program in several
different languages, some of which I like more than others. -
Python
-
Dr Jonathan Carroll ☛ Functions over Idioms - Writing R in Python with rfuns -
I occasionally need to use Python directly - an SDK wrapping an API exists and I don’t particularly want to spend a lot of time writing my own R version, especially before I know what I want to get out of the endpoints. At this point I tend to bump up against my muscle-memory from R and try to use functions I’m familiar with from R, but which don’t actually exist in Python. Now, that might sometimes be because the pattern I’m trying to encode simply has a different name in Python; instead of an sapply(x, f)
-
Rlang ☛ Functions over Idioms – Writing R in Python with rfuns
I occasionally need to use Python directly – an SDK wrapping an API exists and I don’t particularly want to spend a lot of time writing my own R version, especially before I know what I want to get out of the endpoints. At this point I tend to bump up against my muscle-memory from R and try to use functions I’m familiar with from R, but which don’t actually exist in Python. Now, that might sometimes be because the pattern I’m trying to encode simply has a different name in Python; instead of an sapply(x, f)
-
Kevin Renskers ☛ Loopwerk: uv is fantastic, but its package management UX is a mess
Astral’s uv has taken the Python world by storm, and for good reason. It is blisteringly fast, handles Python versions with ease, and replaces a half-dozen tools with a single binary. I’ve written multiple articles about it before.
Getting started with a new Python project using uv and adding your first dependencies is very easy. But once you move past the initial setup and into the maintenance phase of a project, i.e. checking for outdated packages and performing routine upgrades, the CLI starts to feel surprisingly clunky compared to its peers like pnpm or Poetry.
-
-
Shell/Bash/Zsh/Ksh
-
Linuxize ☛ Bash Arithmetic: Integer and Floating-Point Math
How to do arithmetic in Bash with the (( )) operator, $(( )) expansion, the let builtin, and bc or awk for floating-point math the shell cannot do natively.
-