Programming Leftovers
-
Rlang ☛ The Complete Guide to Using setdiff() in R: Examples and Best Practices
The setdiff function in R is a powerful tool for finding differences between datasets. Whether you’re cleaning data, comparing vectors, or analyzing complex datasets, understanding setdiff is essential for any R programmer. This comprehensive guide will walk you through everything you need to know about using setdiff effectively.
-
Caleb Hearth ☛ Ask Git to Show a Method
The downside of using git blame is that if the range of lines in your function has had a lot of history to it, git blame may take a while to generate the prefixes to each line. That’s unfortunate since I immediately throw out all of the commit and authorship information with cut. If the slowdown bothers me enough I may spend the time to filter out the git log cruft instead.
-
Jake Lazaroff ☛ What's a Single-Page App?
The web development community talks a lot about single-page apps, but are we all on a single page?
Heydon Pickering tackled this question in his similarly-named article What Is A Single-Page Application? The TL;DR — spoiler alert! — is that it’s a website that uses a ton of JavaScript to improve user experience by showing you a loading spinner.
-
Ruben Schade ☛ Using git rm on files you already deleted
In today’s installment of things you already know, unless you don’t, we’re looking at dealing with deleted files in git.
-
Rlang ☛ A template for creating card sorting games in R
Last week I made the small card sorting game called The Climate Impact Sorting Challenge where the challenge is to sort cards with different foods in the order of their climate impact. But then the thought hit me: Any time you find yourself with a dataset with labels (say, types of foods) mapped to numbers (say, climate impact in CO2e) you could turn that into a card sorting game! So, I created a template to facilitate this, and in this post, I’ll show you how to make card sorting games like these using R (or really any data-savvy language): [...]
-
Karl Seguin ☛ Zig's (.{}){} syntax
While we can reason that we're creating an allocator, the (.{}){} syntax can seem a bit much. This is a combination of three separate language features: generics, anonymous struct literals and default field values.
-
Scale Venture Partners ☛ The rise of advanced build systems
Advanced build systems will make “it worked on my machine” a predicament of the past. By enforcing build hermeticity and offering advanced caching tools, the next generation of build tools will allow developers to quickly and confidently build projects from anywhere.
Usability and cost remain the biggest adoption hurdles. The winning solutions in this space will gain trust through high quality developer experience, cross-platform compatibility, and powerful integrations.
The build systems shift will change development workflows. CI volume will increase as build costs go down. Collaboration will increase as building new projects gets easier. The biggest effect of all, though? That the best justification for a coffee break – “my code’s compiling” – is on its last legs. Guess we’ll have to find a new excuse.
-
Buttondown LLC ☛ A list of ternary operators
Sup nerds, I'm back from SREcon! I had a blast, despite knowing nothing about site reliability engineering and being way over my head in half the talks. I'm trying to catch up on The Book and contract work now so I'll do something silly here: ternary operators.
Almost all operations on values in programming languages fall into one of three buckets:
- Unary operators, where the operator goes before or after exactly one argument. Examples are
x++
and-y
and!bool
. Most languages have a few critical unary operators hardcoded into the grammar. They are almost always symbols, but sometimes are string-identifiers (not
). - Binary operators, which are placed between exactly two arguments. Things like
+
or&&
or>=
. Languages have a lot more of these than unary operators, because there's more fundamental things we want to do with two values than one value. These can be symbols or identifiers (and
). - Functions/methods that prefix any number of arguments.
func(a, b, c)
,obj.method(a, b, c, d)
, anything in a lisp. These are how we extend the language, and they almost-exclusively use identifiers and not symbols.1 -
Chris ☛ Reading Notes: MPI and Message Passing Concurrency
-
K Desktop Environment/KDE SC/Qt
-
Performance of data import in LabPlot
In many cases, importing data into LabPlot for further analysis and visualization is the first step in the application:
LabPlot supports many different formats (CSV, Origin, SAS, Stata, SPSS, MATLAB, SQL, JSON, binary, OpenDocument Spreadsheets (ods), Excel (xlsx), HDF5, MQTT, Binary Logging Format (BLF), FITS, NetCDF, ROOT (CERN), LTspice, Ngspice) and we plan to add support for even more formats in the future. All of these formats have their reasons for existence as well as advantages and disadvantages. However, the performance of reading the data varies greatly between the different formats and also between the different CPU generations. In this post, we’ll show how long it takes to import a given amount of data in four different formats – ASCII/CSV, Binary, HDF5, and netCDF.
-
-
Python
-
Rlang ☛ Tapyr 0.2 Update: Package Management with uv and Shiny for Python Testing API
In this release, we’ve replaced poetry with uv as the primary tool for package management. Although poetry remains a solid option, we found uv to be better suited for the needs of data scientists, offering a more streamlined workflow.
-
James Bennett ☛ Three Django wishes
’Tis the season when people are posting their “Django wishlists”, for specific technical or organizational or community initiatives they’d like to see undertaken. Here are a few examples from around the Django community: [...]
-
-
Rust
-
Niko Matsakis: MinPin: yet another pin proposal
This post floats a variation of boats’ UnpinCell proposal that I’m calling MinPin.1 MinPin’s goal is to integrate
Pin
into the language in a “minimally disruptive” way2 – and in particular a way that is fully backwards compatible. UnlikeOverwrite
, MinPin does not attempt to makePin
and&mut
“play nicely” together. It does however leave the door open to addOverwrite
in the future, and I think helps to clarify the positives and negatives thatOverwrite
would bring.TL;DR: Key design decisions
Here is a brief summary of MinPin’s rules
-
There's one widespread exception to this categorization: the ternary operator bool ? x : y
.2 It's an infix operator that takes exactly three arguments and can't be decomposed into two sequential binary operators. bool ? x
makes no sense on its own, nor does x : y
.
Other ternary operators are extremely rare, which is why conditional expressions got to monopolize the name "ternary". But I like how exceptional they are and want to compile some of them. A long long time ago I asked Twitter for other ternary operators; this is a compilation of some applicable responses plus my own research.
(Most of these are a bit of a stretch.)