Ranging over functions in Go 1.23
Go 1.23 shipped with a new major feature: ranging over functions (also known as "iterators"), per this proposal. This feature is nicely covered in the official Go blog post from August. This article is a rewrite of my older post that described this feature when it was still in …
Bloch sphere
When learning the basics of quantum computing, the Bloch sphere comes early on as a visualization technique of quantum states. It shows the state of a single qubit as a point on this sphere: This post explains how the Bloch sphere works and also why it works. Mapping 4 dimensions …
Calculating the norm of a complex number
In this quick post I'll dispel a common confusion in the basic math of complex numbers. It's often useful to calculate the norm-square (also known as absolute square) of a complex number z. This norm-square is denoted |z|^2. One could naively expect that: \[|z|^2=zz\] However, that's false …
Notes on running Go in the browser with WebAssembly
Recently I've had to compile Go to WebAssembly to run in the browser in a couple of small projects (#1, #2), and in general spent some time looking at WebAssembly. I find WebAssembly to be an exciting technology, both for the web and for other uses (e.g. with WASI …
Implementing Raft: Part 4 - Key/Value Database
This is Part 4 in a series of posts describing the Raft distributed consensus algorithm and its complete implementation in Go. Here is a list of posts in the series: Part 0: Introduction Part 1: Elections Part 2: Commands and log replication Part 3: Persistence and optimizations Part 4: Key …