we have f-strings at home: quasi-f-strings in c

afraid not, here is a quick rant completely unrelated to the rest of the content: overhyping shit is so ass. its much better to have low expectations, or better yet, not know what to expect. gone are the days when steve jobs could change the world with a single presentation announcing the iphone. now theyve overedged my ass so much that when agi befalls us and ruins the world, ill be fatigued and unimpressed ...

April 11, 2026

church encoding

check this out: $\mathrm{math}$ anyways, let us explore church encoding today. last time we talked about lambda calculus ($\lambda$-calculus) and implemented a beta-reduction ($\beta$-reduction) engine. we claimed lambda calculus to be a “model of computation” but so far it has done nothing apart from being a brain stimulant as we look for the next beta-redex to reduce. church encoding is a way to assign familiar names to some of these unfamiliar lambda terms, named after alonzo church. beware that i am only taking the very basic definitions and extrapolating the rest of the mathematics mostly on my own, so they may deviate from the “canonical” church encodings ...

April 4, 2026

lambda calculus endeavors

i would NOT survive a drug addiction. ive recently realized that maybe the algorithm really is giving me brain damage – when i finish an extra 6 hours of coding on top of 8 hours at work, eyelids barely holding up, it doesnt even occur to me that the reasonable decision would be to sleep. why of course i gotta make sure i havent missed anything on youtube today, all of it ...

March 22, 2026

pattern matching in c++

i had to write nested switch cases and i hated it so i decided to roll my own primitive pattern matching in c++ ocaml can be beautiful sometimes (unfortunately the same cannot be said for c++): let rec last2 l = match l with | [] | [_] -> None | [x; y] -> Some (x, y) | _ :: t -> last2 t for my use case it’d be smth like let get color shape = match (color, shape) with | ("orange", "circle") -> "basketball" | ("orange", _) -> "orange chicken" | (_, "circle") -> "jupiter" | _ -> "love" ah i forgor abt python: ...

April 29, 2025

c++ template-like invocation in python

so the other day for whatever reason i really wanted to invoke python functions as if they were c++ template functions… like so: template <int x> int add(int y) { return x + y; } printf("%d\n", add<5>(3)); if we ignore semantics, add<5>(3) seems to be a valid python expression – roughly translating to add.__lt__(5).__gt__(3) i quickly whipped up a prototype: class TemplateAdd: def __init__(self): self.x = None def __lt__(self, x): self.x = x return self def __gt__(self, y): return self.x + y add = TemplateAdd() print(add<5>(3)) but somehow it prints True… thanks, chained comparisons. the expression add<5>(3) evaluates to add.__lt__(5) and 5 > 3, and with no way to overload the and operator, the dream is dead unless i come to terms with the deranged syntax of (add<5)>3 (doesnt <5)>3 kind of look like a fish?) ...

January 29, 2025