ho lyun jeong

hi im lucas. i write code and do other things sometimes

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

the history of philosophy, a.c. grayling - 4 the presocratic philosophers: parmenides, zeno

ok today imma try smth different cuz yesterday i kinda went back to quoting the book. imma try j reading first and then write notes down w minimal referring back to the book the presocratic philosophers parmenides parmenides wrote his philosophy in a hexameter verse. in his poem, split into two parts “truth” and “opinion”, a young man is taken up in a chariot to meet a goddess who promises him that he will learn all things from her. kinda reminds me of 离骚 but ig the latter is not philosophical in nature? not sure. need to actually finish reading that poem oops ...

April 28, 2025

the history of philosophy, a.c. graling - 3 the presocratic philosophers: pythagoras, xenophanes, heraclitus

the other day i was (yet again) trying to justify my disgusting doom scrolling behavior. ive always resorted to the line of logic that reels and books are but different media for putting the author’s idea out there. but then i came up w the argument that it must be a pain in the ass to publish a book, and if someone is willing to go thru all that then maybe whatever they got is better than tralalero tralala ...

April 27, 2025

the history of philosophy, a.c. grayling - 2 the presocratic philosophers: thales, anaximander, anaximenes

it sure has been a while since i last did this… i have been quite busy – whenever im not at work, eating, or out and about , i am busy consuming the infinite fountain of wisdom some call “instagram reels”. the world could use some innovation in the year of 2025 – we can start by replacing the nonsensical gibberish of lorem ipsum with relatable idioms like “lirili larila”, “bombardiro crocodillo”, “bombombini gusini”, and “tralalero tralala” ...

April 18, 2025

the history of philosophy, a.c. grayling - 1 introduction, philosophy before plato

introduction for almost all of its history ‘philosophy’ had the general meaning of ‘rational enquiry’, though from the beginning of modern times in the renaissance until the nineteenth century it more particularly meant what we now call ‘science’ what we now call “philosophy” was marked by labels such as “metaphysics” and “moral philosophy” to distinguish it from what we now call “science”. the word “scientist” was coined in 1833, since which the words “philosophy” and “science” took on their current meanings ...

February 9, 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