Abstract Nonsense

A place for musings, observations, design notes, code snippets - my thought gists.

Keyslip

I’ve always been a fan of eclectic words. So, inspired by The Dictionary of Obscure Sorrows, I thought I’d coin my own neologism:

keyslip

  1. The sudden, sinking pang of anxiety that accompanies the realisation that one has been typing into the wrong buffer, particularly after a protracted sequence of keystrokes: Always ls a path before you rm it, otherwise you might suffer from a keyslip.
  2. By extension: the interval of frantic clicking that follows sense 1, as the afflicted person attempts to locate where the keystrokes actually landed: Fitts’ law feels like a betrayal after a keyslip.

Pseudorandom number generation in JAX

Recently I’ve been working on a statistics library in Typst called distroMore to come soon. Typst is architected with an incremental compiler, and pairs it with pure functionsAlmost all functions in Typst are pure, with a few exceptions to facilitate snappy real-time compilation.

The problem is, what to do about random number generation when your functions are supposed to be referentially transparent? Well, thankfully that’s a solved problem with a neat solution. For instance, JAX relies on an explicit ‘key’ value, that is consumed by the PRNG, and returns an updated state that is then passed back into the PRNG to generate the next random sample.

PRNG-generated sequences are not truly random because they are actually determined by their initial value, which is typically referred to as the seed, and each step of random sampling is a deterministic function of some state that is carried over from a sample to the next.

Importantly, they warn you to never re-use the same key, else:

The rule of thumb is: never reuse keys (unless you want identical outputs). Reusing the same state will cause sadness and monotony, depriving the end user of lifegiving chaos.

Maybe I should start a collection of humorous academic refrains….

In Typst, there’s a package called suiji that provides pure functions for random-number generation. That allows me to use it within my distro package to produce random variates from distributions using inverse transform sampling:

typst
#import "@preview/suiji:0.5.1": *
#import "../lib.typ": categorical // my `distro` package

#let n_samples = 1000
#let Cat = categorical.new((0.1, 0.3, 0.2, 0.4))
#let counts = (0,) * Cat.weights.len()
#let (rng, u) = (gen-rng-f(42), none)

#for _ in range(n_samples) {
  (rng, u) = uniform-f(rng)
  let result = categorical.sample(Cat, u)
  counts.at(result) += 1
}

Project Hail Mary by Andy Weir

I really enjoyed this book, I thought it was an excellent read.

I found the quality of the writing to be a bit haphazard at the start, but the Haldeman-esque humour and storyline more than make up for that. Weir does a superb job of capturing the pure joy in experimental and theoretical physics without detracting from the pacing or science-fiction nature of the book.

The “vaguely-crustacean alien meets human and becomes intrepid buddy explorer” plotline was delightful, and reminded me of a combination of Arrival and Arthur C. Clarke’s Rendezvous with Rama series.

I haven’t seen the film yet, but I hope it matches the book in quality and enthusiasm. I finished this read in just a day!

Favicon

I’ve added an animated favicon to the site:To avoid becoming distracting, it only plays once, on page load, instead of indefinitely looping.

The design has a few motifs:

  • An upper case $\Lambda$ symbol: a nod to both the Lambda Calculus and the A in Abstract.
  • That morphs into an uppercase blackboard bold $\mathbb{N}$ symbol: the set of natural numbers and the N in Nonsense.
  • All of which is surrounded by square brackets (an array) to give the favicon a bit more presence.
  • Lastly, the serifs are arrow-heads, evoking morphisms from Category Theory.

Full disclosure: I tried multiple times to manually craft an SVG that had all the above components, but I just couldn’t get it right. Thus, inspired by a Google blog post announcing improved SVG design capabilities in the Gemini 3.1 Pro model, I decided to give it a try. It took many, many iterations to coerce Gemini’s output into something I was satisfied with, but I think the end result is pretty good.There’s some issues with the animation keyframes splines not interpolating as smoothly as I’d like, but that’s a problem for another day.

Since SVG favicons are now Baseline-supported across all major browsers, I didn’t need to worry about fallback PNGs and .ico files, which was a nice bonus. It’s also picked up by Google Search and other platforms. Lastly, since I can embed CSS into the SVG file, it also supports dark modes via a prefers-color-scheme media query.

I used an object tag to embed the favicon file above, to ensure that the animation played correctly on page load. I noticed some inconsistencies between browsers with respect to animated SVG support using an img tag.

Generative AI Policy

I’ve added a /ai slash page to my blog with my GenAI policy. I’ve excerpted the current contents below:


“Once men turned their thinking over to machines in the hope that this would set them free. But that only permitted other men with machines to enslave them.”Dune by Frank Herbert.

Every word on this blog is handcrafted by me, often painstakingly. I think of writing as an invaluable form of self-expression, and not one that I wish to delegate to a language model. I enjoy collecting new words, and I’m constantly struggling to develop my writing voiceI freely admit that my grammar could really do with some improvement..

Unless otherwise stated, all code snippets are also written from scratch. If I used any textbook or blog resources to inform my code, I’ll attribute it inline.

That’s not to say that I’m a complete luddite.

If I want to learn how something works in more detail, I think using an LLM for rubber-ducking can be an invaluable asset to practice the Socratic method. A lot can be gleaned by cutting down a provided scaffold to its essentials, and through that process coming to understand how it works. I wrote a little bit about that here, but I should probably revisit that post and flesh it out into a mini-essay sometime.

I will also happily delegate HTML, CSS, JS to LLMs. Whilst I’d like to be better at it, design is certainly not my forte. Similarly, I don’t mind using LLMs to generate throw-away shell scripts for data munging and the like.

Lastly, if I respond to your email, rest assured it’s really me and not a bot.


There are many essays that I concur with on the nature of thinking-through-writing and the dangers of AI-induced atrophy. A good place to start is “The machines are fine. I’m worried about us.”