Programming Leftovers
-
A brief brush with writing and using Python type hints
I was recently nerd sniped into writing a Python version of a simple although real exercise. As part of that nerd snipe, I decided to write my Python using type hints (which I've been tempted by for some time). This is my first time really trying to use type hints, and I did it without the benefit of reading any 'quick introduction to Python type hints' articles; I worked from vague memories of seeing the syntax and reading the documentation for the standard library's typing module. I checked my type hints with mypy, without doing anything particularly fancy.
-
Writing a lambda calculus interpreter in Rust
I have studied lambda calculus at university a lot – our first year CS course was functional programming, there was a second year logic course where lambda expressions were used as proofs of mathematical statements represented as types, there was a fourth year CS course which taught different programming paradigms (including functional programming) by just implementing an interpreter for a basic language in that paradigm… it’s kinda becoming second nature to me at this point. Given that I’ve done this so often, I figured I should make a lambda calculus interpreter in Rust to become more familiar with how to use it.I've been working on my programming language for a couple of months now, in fits and starts1. In the original post, I laid out my plan for it, and after creating the parser the next step was writing a formatter. I thought this would be a nice intermediate step after writing the parser, something easy to exercise the code without being as complicated as the interpreter.
Well... It was hard, even with the shortcuts I took.
-
Thinking about functional programming
Someone on Discord asked about how to learn functional programming.
The question and my initial tweet on the subject prompted an interesting discussion with Shriram Krishnamurthi and other folks.
So here's a slightly more thought out exploration.