2025-09-18: Daily notes and more AIFPL

Published: 2025-09-18

Daily notes and more AIFPL

Interesting links

AIFPL syntax highlighting

As we now have a new language and user docs, it made sense to add an AIFPL syntax highlighter. This is essentially a cut down version of the Scheme syntax highlighter, but is already somewhat diverged.

Improving the terminal (again)

I noticed Claude doing some slightly odd things with the terminal emulator and seemingly sending extra newlines. I realized that even though I'd changed "command" to "input" this was actually very misleading. What we're actually sending are keystrokes.

As I was clearing that up (and strengthening the descriptions) I also discovered the code was automatically adding a newline to any string, which is wrong! Now removed, and things seem to be working much better as a result.

Extending AIFPL

At the end of yesterday, AIFPL had quite complex evaluation capabilities, but didn't have the ability to define functions or to bind variables. Today that changed!

With this came a ton of new complexity because we now had to consider recursion and as we want to support significant amounts of recursion to handle looping this required adding tail call optimizations.

While I was at this, I added mutual recursion support.

As AIFPL is designed to allow functional styles of programming the implementation also developed a series of higher order functions (e.g. map, filter).

One interesting thing that emerged was just how many Python behaviours had seeped into the original design and that were causing problems. The python notion of "truthiness" was a problem.

As we were clearing up the code, we also implemented lazy evaluation forms form and and or, to match with the previous lazy if.

Had Claude write me extensive unit tests for the new language. This found and flushed out quite a lot of subtle issues.