RSSAmplifier

Blog

James Cash's blog

Occasionally Cogent, Usually Otherwise

occasionallycogent.comRSS feed ↗91 posts

Latest posts

Base Case

How I Got Here Today ends my first week at the Recurse Centre (remotely) and it’s been a very enjoyable experience thus far. I’d first heard of Recurse via Julia Evans and her delightful & insightful blog. I really appreciated her combination of technical knowledge, ability to learn, and kindness – the latter especially. Since then, it was on my radar as a place for the few…

Books of 2025

In Search of Lost Time: Volume IV - Cities of the Plain - Marcel Proust Continuing the series from last year. Somewhat unexpectedly (although I guess the title should have given it away), the theme of this volume is homosexuality, both in men and women. For the time period in which it’s set, surprisingly accepting. This marks the end of the volumes of In Search of Lost Time that are in the…

Prolog Projects Tips

As I’ve been writing about here for a while now, I quite like Prolog as a general-purpose programming language. It’s a lovely, very high-level language, quite comparable to Lisp (with M-Expressions instead of S-Expressions) and my implementation of choice, SWI-Prolog, has a very substantial standard library, is open-source, and very easy to contribute to. However, it is still quite a…

Coming Out Strong

I’ve spent a lot of my life with my baseline mood being “unhappy”. I chalked it up to having a “melancholic” temperment, or (if I was in a particularly bad mood) a justifiable response to being shitty. I had good days, of course, happy things happened, but it always felt like my baseline was sad and it wouldn’t take much to knock me down and keep me there. I…

An Unsweetened Memory

For some reason, a memory returned to me today of how I would write Haskell when I first learned it, in 2007 or so. I was just getting into programming and more interesting languages in particular, having started with Turbo Pascal in high school, then getting into Lisps and the like. Scheme was the language that I really found rapport with, but I wanted to learn as many different sorts of language…

Social Update

I’ve been using Mastodon as my only social media for a while now. I started on mastodon.social, but moved over to Fosstodon after a while, desiring a slightly smaller, more focused instance. That was fine for a while; the local timeline was actually useful and I found some people to follow from there. Over time though, I found myself not caring so much about the local timeline and I’d…

Quick Tip: Interval Trees in Prolog

Today I had a need to be able to efficiently look up mappings from a range to a value in Prolog. The initial naïve version looked essentially like this: find_thing_in_range ( Mapping , Key , Value ) :- member(start_end_value( Start , End , Value ), Mapping ), between( Start , End , Key ), ! . Simple, nice and declarative: I build up a list of terms like start_end_value(Start, End, Value) to…

Auto-Formatting Prolog Code

My Prolog LSP server has recently gained a new feature – the ability to automatically format code. This has been quite a fun feature to write. The approach I took was to use the built-in prolog_read_source_term/4 to parse a Prolog source file in a structured way that maintains comments and source positions of terms. Just before this I’d written an LSP code formatter for another…

Self-Indulgent Design Refresh

Inspired by maya.land , I decided to do something a little bit more interesting with my site’s layout. There are still more changes I’d like to make, but I’m hoping a bit of a weird border and a interesting typeface give this thing a little bit more character. I’ve been very busy recently, what with having a toddler and a lot of work, but I’m going to try posting more…

Books of 2024

The History of the Decline and Fall of the Roman Empire , Edward Gibbons I’d read the abridgement in 2017, but I decided last year to give the whole thing a go. Having an ebook version was a necessity, as it is about 5,000 pages, 11,000+ including end-notes. Still, a surprisingly easy read. Really interesting history, Gibbons tells a very compelling story over such a long arc that I was…

Holding Stationæry

This post is a bit of a departure from what I “usually” write here; not so much technical or exploring an idea, just my story of how I fell into the world of stationery. If you follow for the tech posts, you may want to give this one a skip… Like most kids, I remember loving notebooks. There was something so adult about writing important things down, how cool a little pocket…

ClojureScript contra Rust

I’ve used Rust a tad a number of years ago and found it fine, but recently decided I wanted to give it a go again and see what it’s like these days. Always fun to learn something new! I chose for my “test-bed” project a native GUI version of a little ClojureScript webapp I’d thrown together to view and edit the UDDF files for my scuba dives. The ClojureScript version…

Books of 2023

Station Eleven - Emily St. John Mandel A recommendation from my mother. I quite enjoyed this; I was kind of afraid to read a post-apocalyptic story – they feel a little too real for me nowadays – but this one was nice. Probably helps that much of it is set in Toronto, which is something that a resident of that city always appreciates. A History of Philosophy: Volume IV: Descartes to…

Tailwind "Versus" CSS

When I first came across the idea of “utility-class” CSS “frameworks” (the first one I recall hearing about was called “Tachyon”), I didn’t think much of them. “I already know how to write CSS”, I thought. “Why would I bother with this ‘Mickey-Mouse’ version?” and then dismissed the notion. I’ve since come around…

Practical Relaxation

Last summer, my dad and I finally did something we’d been talking about for something like twenty years and got our scuba diving certifications. A friend of my father was also interested in learning to dive and had found a dive shop that was only an hour or two away from us. It turns out that the little dive shop is in fact the oldest PADI dive school in the country and is staffed by…

Philosophical Excursions

My recent reading has taken me on a bit of tour of Western philosophy. Like a vulture circling, I started by soaring above, getting a high-level view, then closing in on some interesting details. The first phase was reading Frederick Copleton’s nine-volume A History of Philosophy . It covers a lot of ground, going from the pre-Socratics to Jean-Paul Sartre. I found that Copleston kind of…

Brief Thoughts on "AI" and LLMs

There’s so much discourse around the new class of “large language models” (henceforth “LLM”s) going around that I feel compelled to write my thoughts out. To begin, there’s this persistent problem with our language around these things. It’s far too easy for people to talk about these language models “thinking” this or “recognizing”…

Books of 2022

Debt: The First 5,000 Years - David Graeber One of the best books I’ve ever read. Fundamental Chess Openings - Paul van der Sterren Long, but very interesting chess book. There’s a ton of depth in modern chess opening theory, but books like “Modern Chess Openings” which are chess encyclopedic lists of moves and variations aren’t really “readable”. This…

Our Vacation

Our vacation in Washington state didn’t go exactly as we expected. The plan was to walk for eight days, from Snoqualmie Pass to Steven’s pass, hiking along the Pacific Crest Trail. We’d been planning this trip for nearly a year and were excited to be off. We had all the gear we’d need – multiple layers, rain cover, food for the eight days the journey would take, plus…

Focus on the Mac

Unicode Input Vexingly, there isn’t really a straight-forward way for a keyboard to send “👍”. The USB HID only defines a limited number of keycodes – basically ASCII plus control keys – so if we want to be able to send emoji directly from the keyboard, some extra step will be required. The Kaleidoscope , the firmware of my beloved keyboardio Model 01 , has a…

Automaking Prolog, Part Two

Last time , I talked about the process that led me to building my “automake” tool for Prolog. Today, I wanted to go into the details of how I put it together. Note that the code below is as of 23 February 2022 – things may have changed since then. You can find the full code here prolog/automake.pl Let’s start with the simple part: automake.pl . This is the little bit of…

Automaking Prolog

I’ve been gradually building some little tools for myself to enhance the web development experience in Prolog. My “day job” is still primarily Clojure, but I really enjoy using Prolog and I’d like to bring the experience of building web apps up to par. I couple of years ago, I made a pack for generating CSS from Prolog terms (in the style of Garden for Clojure). It was nice…

Books of 2021

The Club - Leo Damrosch Not exactly what I was expecting, but very enjoyable. Theoretically, the story of “The Club”, this group of famous English intellectuals, but in practice more of an exegesis of mid-eighteenth century London, mainly through the perspective of Samuel Johnson and James Boswell. I quite enjoyed it, although it didn’t really have much of a cohesive narrative…

Levenshtein Distance in Prolog

I recently came across a neat article about calculating the Levenshtein distance between strings in Clojure. I liked the process of making the algorithm more efficient, but I was somewhat surprised they opted to not look into memoization. They said that “memorisation (sic) introduces state and detracts for the functional purity of the solution”. While memoization does introduce some…

Maximalist Minimalism

Premises Two somewhat-contradictory ideas that I hold: Too many people in the tech world make too much of a fetish of “minimalism” Too many people in the tech world vastly over-complicate things. Now, presenting these two things as opposites is something of a false dichotomy – it’s entirely possible (and maybe even probable) that a surfeit of minimalism at one level may…

One Year of Writing

Last year, I decided I wanted to get more comfortable writing fiction. As with my previous effort of getting better at drawing, I set myself a challenge to do a little bit every day for a year. I had fun with this; it was much harder than the drawing effort, since I had to come up with an idea each day. Originally, I would just write for 15 minutes, but that soon morphed into “roughly fill a…

Emacs Completes Me

New Things For no particular reason other than wanting to try something new, I’ve migrated away from Helm to a completion setup for Emacs based on Protesilaos’ latest config (see prot-minibuffer.el ). That is, just using normal Emacs completion – albeit with some of the new goodies from Emacs 28 – along with Embark, Consult, and Orderless. My Helm configuration was pretty…

Some Emacs advice

First, A Note Last year, I experimented with making some videos about Emacs. I really enjoyed the process and the very nice feedback I received, but – obviously – I haven’t made one in a while. There are a few reasons for that. The first is that I’ve been quite busy – I moved at the end of the year and work on various projects has kept me quite occupied. That’s…

The Problem With Free Software…

There’s been another rash of discussion about the challenges of making FLOSS software, this time sparked off by the problem of funding Babel . The specifics are different, but the general thrust of the story and the reactions to it aren’t new: Someone devotes a large amount of their time and effort to making something that many people both depend on and make piles of money from, but…

Books of 2020

Nature’s Building Blocks - John Emsley Re-read of a very fun book, talking about all the elements and interesting facts about each one. My Affairs - Nathan J. Robison Oh boy, this didn’t age well. A future memoir, from the alternate reality where Bernie Sanders won. At the time, it was kind of hard to read, because it felt like I was reading about a great future that we might have, but…

Customizing the Emacs Modeline: Video Edition

I took a crack at making a video version of my previous post on customizing the mode-line in Emacs.

Getting Evil with Emacs

In this week’s video, I discuss some little gotchas with vim-style keybindings with Emacs in Evil-mode.

Introspective Emacs

This week’s little video is on taking advantage of Emacs’ introspective abilities to see what functions are being invoked, how they work, and changing them.

Reading with Emacs

A short little video about my workflow for reading books with pdf-tools and org-pdftools in Emacs.

Intermediate Emacs: Customizing Helm

My previous video on Emacs went fairly well, so I tried making another: This one touches on some more specific details on how I customize Helm & how to create custom Helm sources. If you found that interesting, you may want to have a look at my previous posts on adding custom actions and creating a custom Helm source .

An Emacs Configuration Overview

I tried making a little video explaining how I organize my Emacs configuration. Hopefully someone out there finds it vaguely interesting or useful!

Programming Isn't Coding

When teaching “programming”, a surprisingly small amount of time is spent actually helping students with logic – and a lot helping them learning & managing programming tools. Programmers like to think that they spend all their time creating elaborate & complex abstractions but far more time is consumed dealing with the tools and idioms encrusted with historical baggage.…

Translating Idioms

I often advocate to people that I’m helping learn programming that they should learn more programming languages. One of my early influences on programming was Steve Yegge and from him I internalized the idea that a good programmer should be a polyglot. At the time, I just accepted that as a given, but as I do more teaching, I’ve had the opportunity to think more deeply about why that…

Building Bard

What is Bard? Last year, I had an idea for a useful little tool – a shell that could record the changes I made. The motivation was having to do occasional sysadmin tweaks on production servers. We always want to have scripts or Ansible playbooks that will reproduce the state of a server, but sometimes some exploratory direct work is needed to figure out what to do. We then have to try to…

Continuations in Prolog

One of the concepts in programming that I found most challenging to learn is the “continuation”. I was first introduced to the idea in Scheme, which features “first-class continuations”. These allow one to capture “what’s going to happen next” as a closure that can then be passed around. For purposes of example, we’ll look at delimited continuations,…

Books of 2019

The Worldly Philosophers - Robert L. Heilbroner Super interesting, really enjoyed it. Bite Me - Christopher Moore Weird & funny, entertaining read. The Productive Programmer - Neal Ford Okay - interesting, sorta, but disagree with a lot. Very OOP & java-focused. The Hobbit - J.R.R. Tolkien Re-read, fun. The Fifth Season - N.K. Jemisen Read last year, forgot to write down. Very fun series. The…

helm-switch-shell

After more than a decade of using Emacs, I finally released my first package . It’s a little thing that grew out of my config , but is useful enough that I want to share. As I explained in the above-linked post, I use lots of eshells and wanted a way to easily switch between them. I made a few enhancements since I last wrote about the system though: The biggest is that I made it sort the…

Adding JSON Feed Support

For no particular reason, I decided to try to add support for JSON Feed for my blog here. I write everything here in org-mode files & publish it using an Emacs script, based on Ambrevar’s setup . That uses feed-builder.el to generate the XML for RSS, which is pretty simple, so I took a shot at implementing the equivalent for JSON Feed. That code can be found here . I may publish it later, or…

Reading Email in Emacs

Previously I’d set up a system to read email in Emacs before, using notmuch, which I quite liked. Notmuch and notmuch.el were very nice for reading, but I didn’t stick with it because getting mail in to the system was somewhat cumbersome. I’d used Offlineimap to pull mail down, but that was quite slow and due to some sort of race condition or something, it would get wedged fairly…

Prolog Fundamentals Catchup

As a consequence of the fact that I got in to Prolog not through what seems like the more typical academic route, but via Anne Ogborne’s great tutorial on using Prolog for web applications, I think I missed out on some of the fundamentals of the language. At this point I’ve written enough code in Prolog that I’m pretty comfortable with the basic syntax & semantics, but there are…

A Prolog Language Server

Short version: I wrote a Prolog language server implementation – give it a try! The Genesis Since I started using Prolog last year, I’ve been wanting to improve the editor story. Most of my actual work is using Clojure and I’ve been using Lisps for years, so I’ve gotten used to having something like CIDER or SLIME . Prolog (SWI-Prolog in particular) has a lot of pretty…

A Very Specific Prolog Warning

The Very Short Version: If you’re going to open an input file stream in SWI-Prolog, then pass that stream to a foreign function that’s going to use the file descriptor, make sure you open it with bom(false) – e.g. open(File, read, Stream, [bom(false)]), some_foreign_pred(Stream). . The Slightly Longer Version How did I come across this? As part of a little project I’m…

/A Pattern Language/ versus /Design Patterns/

I recently read a fascinating book by Christopher Alexander (and others) entitled A Pattern Language . I’d heard a lot about the book & had started reading it previously, but finally went out, bought a copy, and read the whole thing. The idea underlying the book is that there are some things that make physical spaces “nice”. Some cities, some neighbourhoods, some houses, some…

Writing a Custom Helm Source in Emacs

While Helm is an invaluable part of the way I use Emacs, I find it not particularly obvious how to extend it, often having to resort to reading a lot of the code to figure out how things work. Previously, I wrote about making custom Helm actions in Emacs ; this time, I wanted to make a custom helm source. I’ve been using EShell a lot recently. I’ll occasionally use a real terminal…

Git Over Email?

I keep looking at “Source Hut” (née “srht”) and its email-centric approach to git. It kind of appealed to me in the sort of theoretical, slightly-masochistic way that switching to BSD or terminal-only mode has in the past – something that is idealized as being simpler, more efficient, allowing one to use the honed tools of true hackers, or whatever. However, after…