• posts projects
    • February 21, 2021
    • 6 minutes
    • Graphics
    • Fractals
    • Math
    Fractals on The Web

    Last week, I made a little web application for visualizing some fractals, and I thought I’d write up a few thoughts about how it works.

    • February 14, 2021
    • 11 minutes
    • Math
    • Spaced Repetition
    • Study
    Spaced Repetition for Mathematics

    Recently, I’ve been experimenting with using spaced repetition for self-studying “advanced” mathematics. This post goes through my motivations for adopting this system, as well as a few techniques I’ve used in adapting it to mathematics.

    • February 05, 2021
    • 5 minutes
    • Haskell
    • Programming
    Programming Problem: Run-Length Encoding

    This is just a quick post about a programming problem that’s been circulating around on twitter recently:

    • February 02, 2021
    • 17 minutes
    • Math
    • Set Theory
    • Topology
    Tychonoff's Theorem and Zorn's Lemma

    Tychonoff’s theorem proves that the product (even infinite) of compact spaces is also compact. The proof makes judicious use of Zorn’s lemma. In fact, it uses it so well, that I gained an appreciation for how fun the lemma can be.

    • January 24, 2021
    • 6 minutes
    • Compiler
    • Programming Languages
    On Strings in Compilers

    I’ve been thinking recently about handling strings and names in compilers in a more principled way, and I think I’ve come up with a nice way of doing this.

    • January 16, 2021
    • 6 minutes
    • Algorithms
    • Programming
    Let's Describe Algorithms Better

    I was reading a cryptography textbook, and I came across an algorithm that reminded me why I often dislike descriptions of algorithms in textbooks. This is a short post going over this example, and thinking about how to improve these descriptions.

    • January 10, 2021
    • 13 minutes
    • Haskell
    • Compiler
    Making an IO

    Recently I’ve been wrapping up my work on a compiler for a subset of Haskell. While my subset doesn’t (yet) have any support for IO, I’ve been thinking about how to implement it.

    • December 31, 2020
    • 8 minutes
    • Haskell
    • Category Theory
    (Basic) Universal Properties in Haskell

    This is a post going over the basic concept of defining objects through Universal Properties, in Category Theory, with explanations and examples in Haskell.

    • December 28, 2020
    • 67 minutes
    • Haskell
    • Programming Languages
    • Compiler
    (Haskell in Haskell) 3. Parsing

    This is the third post in the Haskell in Haskell series.

    In this post, we’ll go over creating a parser for our subset of Haskell. This stage of the compiler is responsible for taking the tokens that our lexer produced in the previous part.

    • December 13, 2020
    • 12 minutes
    • Math
    • Algebra
    • Programming
    Chinese Remainder Theorem for Programmers

    This is a quick post about the Chinese Remainder Theorem. Specifically, how to use it to solve a system of system of simple modular equations.

    • December 10, 2020
    • 61 minutes
    • Haskell
    • Programming Languages
    • Compiler
    (Haskell in Haskell) 2. Lexing

    This is the second post in the Haskell in Haskell series.

    In this post, we’ll go over creating a lexer for our subset of Haskell. This stage of the compiler goes from the raw characters in our a source file, to a more structured stream of tokens.

    We’ll finally be digging into some serious code this time, so get your editor ready if you’re following along!

    • December 07, 2020
    • 7 minutes
    • Algebra
    • Haskell
    • Category Theory
    (Un)fold as (Co)algebra

    One cool thing about lists is that they have canonical ways of consuming and producing them: folds, and unfolds. It turns out that these are canonical, in that folding and unfolding functions are themselves isomorphic to lists. In this post, we’ll explore why this is true.

    • December 05, 2020
    • 4 minutes
    • Algorithms
    • Command Line
    • Rust
    A simple algorithm for UNIX's Tree

    This morning I decided to implement my own version of UNIX’s classic tree command in Rust. I thought the algorithm was both non-trivial, and interesting enough to warrant a quick blog post.

    • November 23, 2020
    • 19 minutes
    • Haskell
    • Programming Languages
    • Compiler
    (Haskell in Haskell) 1. Setup

    This is the first “real” post in the Haskell in Haskell series.

    In this post we’ll go over setting up a basic project in Haskell. We’ll be building our compiler on top of this foundation in the next posts.

    • November 10, 2020
    • 9 minutes
    • Programming Languages
    On Deep Immutability

    This post is about the different ways objects can be immutable and mutable in programming languages, why deep immutability is what we really want, and a path towards implementing that in higher level languages.

    • November 01, 2020
    • 13 minutes
    • Haskell
    • Programming Languages
    • Compiler
    (Haskell in Haskell) 0. Introduction

    This is an introduction to a series I’m calling Haskell in Haskell. The goal of this series of posts is to go through the implementation of a subset of the Haskell language, from parsing, to typechecking, to code generation, using Haskell itself.

    • October 19, 2020
    • 2 minutes
    • C
    Always use offsetof

    If you want to find out how many bytes a certain portion of a struct uses, you might be tempted to do some arithmetic with sizeof, but this will yield unpredictable results!

    • October 18, 2020
    • 12 minutes
    • Haskell
    • Programming Languages
    Lexer Combinators

    When you write a parser in Haskell, you want to use parser combinators. When you write a lexer, you should use lexer combinators! We’ll see what these are, and how to use them to write a simple lexer.

    • October 14, 2020
    • 8 minutes
    • Math
    • Probability
    Monty Hall and Counterfactuals

    This is about some shower thoughts I had recently about the infamous Monty Hall problem. Namely, how to make sense of the counter-intuitive results involved. We’ll see how reasoning counterfactually can make the best strategy seem a lot clearer.

    • October 10, 2020
    • 8 minutes
    • Frontend
    • Meta
    My Blog: Version 4

    Having recently inaugurated the 4th version of this blog, I want to go over the technologies that I used to make this, as well as some of the tricky things I had to do to make things work.

    • October 02, 2020
    • 9 minutes
    • Math
    • Graph Theory
    • Category Theory
    Categorical Graphs

    This post is a basic introduction to the idea of Categorical Graphs, or just the standard theory of Graphs, developed through the lens of Category Theory, and generalized in the obvious ways that follow through that lens. This is just an introduction mainly because this theory doesn’t seem to have been developed very far yet, and I haven’t been able to develop it that much independently so far. I think I have a good grasp on some very basic ideas here, and wanted to present them while they’re still fresh in my head.

    • September 28, 2020
    • 8 minutes
    • Rant
    • P2P
    • Internet
    The Web or The Internet?

    So this is going to be a bit of a Rant on some things I’ve been thinking about recently. To set the background for this post, I’ve been working on a note-taking app with a focus on individual blocks referencing eachother. Kind of like Roam. The idea is that this kind of system can be used for discrete nodes of knowledge, which we can call blocks, for simplicity. Blocks don’t contain much on their own, besides some text, and references to other blocks.

    • September 20, 2020
    • 5 minutes
    • C++
    • Gtk
    Wrapping GtkImContext

    So, recently I’ve started working on a text editor, using Gtk, via gtkmm in C++. I’ve decided to try my hand at writing the text area widget from scratch, just using the text layout facilities provided by Gtk’s Pango. My rationale for this is twofold: It seems that Gtk’s TextView widget is missing a few nice things, like source lines, and using the more developed SourceView is not doing a lot of the work myself.

    • September 09, 2020
    • 10 minutes
    • Math
    • Category Theory
    • Haskell
    Recursive Types as Initial Algebras

    Recently (well, more like a month ago), I came across this interesting observation: In my head, I immediately jumped to the notion of Algebras in Category Theory. I had recently studied that notion, found it quite interesting, and was very happy to see this observation, because it was actually quite obvious to me thanks to what I’d recently learned. The goal of this post is to unpack that tweet, and then explain why that observation is true.

    • August 30, 2020
    • 17 minutes
    • Math
    • Category Theory
    • Haskell
    Encoding the Naturals

    In this post, we’ll cover 3 ways I know of encoding the natural numbers $\mathbb{N}$ in your standard functional language with recursive types and polymorphism. At least, these are the 3 most generalized ways of doing it. As we’ll see, some common encodings are just specific cases of a more general encoding. Prerequisites Some familiarity with defining data types in a functional-esque language might be helpful, but shouldn’t be strictly necessary.

    • August 17, 2020
    • 14 minutes
    • Math
    • Category Theory
    • Algebra
    Empty vs NonEmpty Groups

    The usual definition of a Group excludes empty groups by definition. There are alternate definitions of a Group that allow us to include the empty set, and which are quivalent to the normal definition in all other cases. This post explores this alternate definition, and the resulting differences with the normal concept of a Group. What is a Group? A Group is one of the most important structures in abstract algebra.

    • June 18, 2020
    • 7 minutes
    • Math
    • Category Theory
    Monomorphisms vs Epimorphisms

    The concepts of monomorphism and epimorphism are very important in Category Theory. I always had a hard time remembering which one was which until I thought about a good mnemonic.

    • June 10, 2020
    • 8 minutes
    • Typescript
    • React
    • WebRTC
    • Project
    Simple WebRTC Video Chat

    Recently I made an app for making group video calls. The difference between this and something like zoom is that there’s no central server responsible for routing video calls between the participants. Instead, I used WebRTC in order to set up peer-to-peer (P2P) calls between all of the members of a group.

    • June 03, 2020
    • 25 minutes
    • Parsing
    • Programming Languages
    Parsing A Whitespace-Sensitive Language

    This post is about how to parse programming languages which define blocks using indentation, instead of braces and semicolons. We’ll end up learning how to infer these blocks based on the indentation, using Typescript to parse a toy functional language.

    • April 13, 2020
    • 6 minutes
    • Productivity
    • Notes
    What I like about Roam (so far)

    I read a lot of stuff, mainly on the internet. One problem I’ve always had is keeping track of the important bits of the things that I read. The most important information sticks with you, but it’s not easy to remember everything. There’s always a nagging fear that there’s some importing bit you might be missing, or that you might forget something useful.

    • February 13, 2020
    • 15 minutes
    • Programming
    • Frontend
    • Backend
    • Javascript
    • GraphQL
    Against Fullstack Data Sharing

    This is a post about how I work with data in fullstack development. Specifically, I share what I think are good patterns for sharing data and logic between the frontend and the backend of an application.

    • January 31, 2020
    • 19 minutes
    • Literature
    Review: The New York Trilogy

    This is a review of The New York Trilogy written by Paul Auster in 1987.

    As the title says, this book is actually a trilogy of three shorter novels: City of Glass, Ghosts, and The Locked Room.

    • January 10, 2020
    • 7 minutes
    • Learning
    • Spaced Repetition
    Integrating Notes and Spaced Repetition

    So I’ve been tinkering around with better systems for taking notes recently. I’m not a big fan of keeping notes, around because I don’t find myself actually revisiting them, and when I do, I don’t get much value out of it. On the other hand, my experience with language learning has definitely showed me how effective spaced repetition is when it comes to keeping things in your head.

    • January 09, 2020
    • 5 minutes
    • React
    • Hooks
    • Frontend
    • Javascript
    React Pitfalls: useState initialization

    This is a quick post about a “gotcha” I encountered recently in a React application. This involved the use of React’s useState hook, which had a subtle difference between how I thought the hook worked, and how it actually worked.

    • December 28, 2019
    • 12 minutes
    • Japanese
    • Programming
    Structured Immersion

    When it comes to language learning, one approach that I really subscribe to is immersion. This means trying to absorb as much of the language as possible, as often as possible. It’s often said that “speaking with locals” is a good way to accelerate the learning process, and there’s a lot of truth with that statement.

    • October 27, 2019
    • 5 minutes
    • Networking
    • Programming
    Layerability and Abstraction

    This is a post about one of my favorite aspects of networking: how different protocols and concepts are layered together. I go over the concept of Layerability and how it applies to networking and programming more generally.

    • August 31, 2019
    • 9 minutes
    • Rust
    • Programming Languages
    • Concurrency
    Poline

    This is a post about Poline, a tiny programming language I wrote recently. The main “gimmick” of Poline is a feature called Green Threads. In fact, Poline doesn’t have many other features besides them.

    • August 17, 2019
    • 8 minutes
    • Software Architecture
    • Programming Languages
    From Interfaces to Traits

    This is a post about how different languages handle the concept of interfaces. We’ll go over the classical OO way of handling them, with Java, to the more recent approaches of languages like Rust, as well as others in between.

    • July 07, 2019
    • 5 minutes
    • Japanese
    • Rust
    Sentence Banking

    This is a post about ginkou, a tool I made recently. This tool uses Rust, SQLite, as well as mecab to archive sentences, and then to retrieve them based on the words they contain.

    • June 14, 2019
    • 6 minutes
    • Concurrency
    • Go
    Data Races vs Race Conditions

    This is a quick post about the difference between Data Races and Race Conditions, and how data structures or patterns providing freedom from data races can fail to provide race condition freedom.

    • June 13, 2019
    • 2 minutes
    • Rust
    • Emulation
    Introducing Ludus

    This is a short post about a crate I recently published: https://crates.io/crates/ludus. This crate provides the core logic of an NES emulator, and can be used to build independent GUI applications.

    • May 14, 2019
    • 5 minutes
    • Software Architecture
    • Functional Programming
    The Component Pattern

    This post details a useful pattern for organizing stateful components in functional code. This post assumes knowledge of Haskell, up to Monad-Transformers.

    • May 03, 2019
    • 12 minutes
    • Distributed Systems
    • Networking
    Bittorrent Is Hard - 1

    Having worked on a bittorrent client in Haskell recently, I wanted to write about a few tricky aspects of the implementation that I encountered: managing the concurrent piece downloads, and saving them to files.

    • March 06, 2019
    • 6 minutes
    • Functional Programming
    Mutability Is a Great Secret To Have

    When programming in a Functional style, Mutability is often avoided on principle. But what’s more important is having functions be immutable from the outside. In this post we’ll see how to use interior mutation while providing an immutable interface.