RSSAmplifier

Blog

Arialdo on Code

Random thoughts about programming

arialdomartini.github.ioRSS feed ↗10 posts

Latest posts

Pre-emptive Commit Messages

Write commit messages before coding. Describe how the software behaves, not what you have done.

Monadic Parser Combinators in F#

You want to invent a new language, and you want to do this in F#, don’t you? And, of course, you want to base its parser on Monadic Parser Combinators. You’ve always wanted, just admit it.

Emacs: consult-line-symbol-at-point

I’m addicted to consult.el. It is so convenient that when I found out that isearch-forward-symbol-at-point (M-s .) was a thing, I immediately felt the desire to integrate it with consult.el. Luckily, this was way easier than I thought. Let’s walk through the steps I took. As often happens with Emacs, along the path of exploring its source code, we will find some random pearls here and there to…

Emacs: a peek under Imenu’s hood

I promised myself to write a Tree-sitter major mode for F#. I’ve been told that it should not be such an insurmountable endeavour, but given that I start from the scratch, along the journey I will need to learn a bunch of new topics from the ground up. Nice, that’s why we use Emacs, right? For each of those themes, I will publish a little blog post to share the lesson learnt. Today it’s the…

I suck at TDD (and how to fix it) - Review

Summaries From Matteo Vaccari: There’s no easy way to evolve the hardcoded values into general code. Alistair Cockburn said that this problem could be better solved by more mathematically-oriented thinking upfront about how many spaces should be generated where Emily Bache said that “recycling tests” is a valid way to iterate towards a difficult problem Other solutions came from Ron Jeffries,…

I suck at TDD (and how to fix it)

How an innocuous Kata shows that either emergent design does not exist, or that a better way of doing TDD is possible.

xUnit tips its hat to Property-Based Testing

Ever wondered why parametric tests in xUnit are called “theories”? And why are tests called “facts” instead of, well, just “tests”? Investigating on this topic helped me realize that I have always used xUnit theories incorrectly. And that xUnit loves the idea of Property-Based Testing.

Emacs: let’s zoom

Let’s develop squint a little package for controlling the font height, so you won’t need to squint your eyes when you are on smaller screens. It will look like this: It will give us the chance to touch on: Face attributes. Asking the user to choose interactively from a list of options. The powerful consult--read. Lisp’s Dynamic and Lexical Binding. Few other little topics here and there.

State Monad For The Rest Of Us - Part 1

Index Source code: github.com/arialdomartini/state-monad-for-the-rest-of-us Binary Trees Our journey starts with this problem: we want to count the number of leaves of an arbitrary Binary Tree. To keep the problem as simple as possible, we define a Binary Tree as that data structure having Nodes and Leaves, and in which every Node has exactly two branches. This is a Tree with 2 Leaves: Node / \…

State Monad For The Rest Of Us - Part 10

Index Source code: github.com/arialdomartini/state-monad-for-the-rest-of-us In chapter 7, when we wanted to introduce a new type for the result value of index we got to this: // Tree a -> (Int -> (Tree (a, Int), Int)) let rec index = function | Leaf v -> fun count -> (Leaf (v, count), count + 1) | Node (l, r) -> fun count -> let li, lc = index l count let ri, rc = index r lc Node (li, ri), rc I…