news
Programming Leftovers
-
Kenneth Reitz ☛ What the Snare Drum Knew Before I Did
The snare drum knew, before I did, that you can know something without being able to say it. I spent a long time after that learning to say things. The saying only really works when it is still, underneath, in contact with the drum.
-
Aleksandar Vacić ☛ Crash with callback methods in parent-child data sources
Say I have ParentDataSource which holds a strong reference to ChildDataSource, which has a callback method that ParentDataSource implements: [...]
-
Jussi Pakkanen ☛ Multi merge sort, or when optimizations aren't
In our previous episode we wrote a merge sort implementation that runs a bit faster than the one in stdlibc++. The question then becomes, could it be made even faster. If you go through the relevant literature one potential improvement is to do a multiway merge. That is, instead of merging two arrays into one, you merge four into one using, for example, a priority queue.
This seems like a slam dunk for performance.
-
Modus Create LLC ☛ 𝕯𝖔𝖈 𝖎𝖙 𝖑𝖎𝖐𝖊 𝖎𝖙'𝖘 𝖍𝖔𝖙
Everybody knows documentation is essential to any software engineering enterprise. And fo’ shizzle, everybody knows it gets deprioritised. An afterthought; written by engineers who are thinking, “I should probably write docs”. Nah. What they should be thinking is, “I get to write docs, cuz!” Because when you doc it right, it ain’t a chore. It’s what separates a project people use from a project people lose.
In this post, I’m walkin’ you through three real projects I’ve been involved in at Tweag; each one levelling up the documentation game. First, fixing docs that got out of hand: the reactive play. Then, planning docs from day one: the proactive play. And finally, making docs part of the code itself: the integrated play. By the end, I think you’ll agree: to doc it like it’s hot is the only way to gizzo.
-
University of Toronto ☛ Does your DSL little language really need operator precedence?
Operator precedence is nice and there are all sorts of cool algorithms for implementing it without tearing your hair out. But it's mostly nice for arithmetic expressions (or if you have a lot of operators), not for other things you may be using expressions for, such as matching incoming connections against some rules, and implementing real operator precedence will complicate your parser and little language. If you do this regularly and have the relevant algorithms memorized, or if you want an extra learning experience, go ahead and implement operator precedence anyway. Otherwise, well, are you sure you need it? I've been pretty happy with little languages that had little or no operator precedence, among other hacks to make them simpler.
-
Dr Jonathan Carroll ☛ Schotter Plots in R -
What’s missing from this ALGOL code is the seeds needed to reproduce the plot. The author went down a rabbit hole investigating and calculating different values, but managed to determine them to be “(1922110153) for the x- and y-shift seed, and (1769133315) for the rotation seed”. They also provided a translation into Python
-
Zellyn Hunter ☛ Schotter - Georg Nees - Part 1
As a way of dipping my toe into generative art, I’ve been trying to recreate one of the most iconic images in computer-generated art: Schotter (“Gravel”, aka “Cubic Disarray”) by Georg Nees.
Created in 1968, it was drawn using a Zuse1 Graphomat Z64 flatbed plotter.
I found many online tutorials on recreating it, mostly using Processing or its successor, p5.js, but they almost always either (a) used the same random number (scaled) for offset and rotation, or (b) eyeballed the original plot and came up with something that worked.
-
R / R-Script
-
Rlang ☛ What’s new in R 4.6.0?
R 4.6.0 (“Because it was There”) is set for release on April 24th 2026. Here we summarise some of the more interesting changes that have been introduced. In previous blog posts, we have discussed the new features introduced in R 4.5.0 and earlier versions (see the links at the end of this post).
-
Rlang ☛ Schotter Plots in R
Translating things between languages reveals how each language approaches different design trade-offs, and I believe it’s a useful exercise. Having something to translate is the first step. I found a plot I wanted to generate, and some code that reproduced it, so off we go!
-
rOpenSci ☛ rOpenSci | A Better R Programming Experience Thanks to Tree-sitter
A little bit less than two years ago, building on work by Jim Hester and Kevin Ushey, Davis Vaughan completed a very impactful JavaScript file for the R community: an R grammar for the Tree-sitter parsing generator. He even got a round of applause for it during a talk at the useR! 2024 conference! So, did he get cheered for… grammatical rules in a JavaScript file? 😅
No, the audience was excited about the improved developer experience for R that this file unlocked. R tooling around Tree-sitter is how you get [...]
-
-
Shell/Bash/Zsh/Ksh
-
Java/Golang
-
Matt Might ☛ Compiling to Java as a target language
In my advanced compilers class, we cover a range of intermediate and target languages.
C is a popular target language for performance reasons, but Java has often-overlooked advantages. Some of Java’s less-utilized features conspire to make it an easy target for high-level language constructs, e.g., lexically scoped closures become anonymous classes.
It takes roughly a third to half the time (and code) to write a compiler that targets Java instead of C. In fact, we can compile the essential core of Scheme to Java with purely local transforms.
-