Let me show you how to use Lindenmayer systems to produce beautiful images like this one: Turtles We’ll start by talking about turtles. Some of you are nodding along like this is an obvious starting point; others are rather confused. In 1967(!) some brilliant engineers designed an educational programming language called Logo . It lets you make turtle graphics drawings by telling a “turtle” with a…
Let’s start where I started. Just thinking about if statements. An if with an else can produce a value: // C int x = -5 ; int abs_x = x > 0 ? x : - x ; # Python x = - 5 abs_x = x if x > 0 else - x // Rust let x = - 5 ; let abs_x = if x > 0 { x } else { - x }; What about an if without an else ? // C int x = -5 ; int abs_x = x > 0 ? x ; // Syntax error! # Python x = - 5 abs_x = x if x > 0 # Syntax…
Have a cheat sheet for Jujutsu . I’ve been learning Jujutsu a.k.a. jj , a version control system that’s compatible with git repos. It’s clicked for me in a way that git hasn’t even after many years of use. The best way to learn something is to teach it, so I wrote a reference and cheat sheet for jj with the help of a friend : The reference describes the state space of a jj repository and how it…
Investigating the Typst programming language. Typst is a modern typesetting system, and a competitor to LaTeX. You can roughly divide it into two parts: it’s a programming language glued to a layout engine . The layout engine deals with The programming language deals with - Margins - Data representation - Padding - Cyclic data - Subscripts - Aliasing - Floating Figures - Mutability - Numbered…
I present a more expressive variant of Wadler’s “Prettier Printer”. What’s a pretty printer? You’ve probably used a code formatter like gofmt or rustfmt or JS prettier . These tools work in two steps: (i) parse the source code in a file, and (ii) print it out nicely. Step (ii) is pretty printing. Pretty printing is the reverse of parsing. Parsing turns linear text into a tree (a parse tree , which…