All posts
Three Futures I: For Whom the Bell Tolls
2026-08-06
Before the radio operator had even finished saying his call sign, somewhere in the avionics bay an instruction pointer jumped to the object code of a hundred thousand lines of C++ which were to a Kalman filter approximately as Claude was to ELIZA.
As Alan Watts pointed out, if youâve achieved your desired mystical insight by direct mental communion with transcendental math entities, chaos demons, non-human intelligences, and so forth, itâs best to cash in your chips and exit the conversation before your sanity takes a hit.
How Far Apart Are Two Wells?
2026-07-15
Like most of reality, thereâs also a surprising amount of complexity to the problem, and a surprising number of small decisions to make along the way.
Inadvisable Unit Shenanigans
2026-06-02
Itâs overwrought, hard to type check, confusing to read, and probably doesnât meaningfully catch errors a human would actually make. Nonetheless, I like it.
Trie-ing Too Hard With 297 and 298 Files
2026-05-13
Once upon a time, there was a family of data formats called 297 and 298.
Blood From a Stone
2026-04-08
Reverse-engineering the Petra .grd grid format.
Zipping Python Trees
2022-12-08
Let's walk amongst the trees for a bit.
âŠI donât believe in the idea that there are a few peculiar people capable of understanding math and the rest of the world is normal. Math is a human discovery, and itâs no more complicated than humans can understand. I had a calculus book once that said, âWhat one fool can do, another fool can.â
âRichard Feynman
Itâs a great time, maybe the best time in the short history of computer technology to date, to learn programming and data science. Youâre surrounded by an incredible wealth of free tools and resources, and the excitement about these disciplines in society at large is palpable. But with that wealth comes danger: snake oil salesmen and the âquick fixâ. The answer is the same as it always was.
Jupyter Ascending: A Retrograde Development
2020-10-13
Computational notebooks combine literate programmingâs interleaving of source text with prose descriptions and multimedia output with image-based developmentâs interactivity and mutability. Itâs the combination of the two ideas that kills notebooks as a practical tool for software engineering.
Fun With Simulated Typestate in Python 3.8
2020-07-21
âThereâs an old saying in TennesseeâI know itâs in Texas, probably in Tennesseeâthat says, âFool me once, shame onâŠshame on you. Fool meâyou canât get fooled again.ââ
âGeorge W. Bush
Itâs true, you canât get fooled again! Not any more than you can open an already-open door. But does your type system know that?
Today, in honor of the recent release of Python 3.8, weâll introduce a fun type-level programming trick well-known already in other language communities, which will let us automatically check these and other invariants.
Irregular Expressions, Revisited
2020-06-26
Last time, we used a minimalist parser combinator library to build a parser for an oddly familiar language called OBAN. The problem with our previous parser is that it produces extremely unhelpful error messages. This is probably fine for a parser which runs as part of an automated toolchain and processes almost-always-valid input, but is completely unacceptable for a user-facing tool.
Weâll address this, while making only minimal changes to the parserâs structure, by tweaking the âbase monadâ on which it's built. In other words, weâll change what it means to chain parsers together.
Irregular Expressions: You Need a Parser
2020-06-22
Some people, when confronted with a problem, think âI know, Iâll use regular expressions.â Now they have two problems.
âJamie Zawinski
The fundamental problem with regular expressions is that they only recognize regular languages. This sounds, and is, tautological, but it has huge implications.
A Dialogue
2020-06-03
SOCRATES: What is âmachine learningâ?
The Shadow Knows
2020-05-26
Itâs a nightmare scenario: trapped behind enemy lines with no hope for rescue. For unfathomable reasons of bureaucracy, your access to Turing-complete tools of the trade has been denied. Will you fight? Or will you perish like a dog (in a mire of spreadsheets)?
Ok, thatâs a little dramatic. But itâs a common-enough dilemma: due to ill-considered IT policies, you donât have access to the tools you need to efficiently automate tedious tasks: compilers, interpreters, debuggers. You can accept defeat and turn to memorizing keyboard shortcuts⊠or you can join the League of Shadows.
Minimalist DCA in Python
2020-05-20
Itâs important, as a rule of thumb, when operating or investing in a firm which produces a physical commodity, to have the ability to reliably quantify the expected future production of the commodity given the firmâs assets. In the oil and gas industry, we have many different ways to forecast future production from an oil or gas well. Some rely on detailed measurements and explicitly incorporate detailed mathematical models of flow physics. Others use whatever historical data we can scrape together and a bit of curve-fitting.
Today, weâre talking about the second kind.
A couple weekends ago, I found myself with the desire to fetch oil and gas production data for a specific county in New Mexico from the New Mexico Oil Conservation Division (OCD).
Fortunately, the OCD provides access to historical well production via an FTP server. The OCD doesnât seem to provide a way to query a limited time- or area-based subset of production history data, so weâre stuck with a single ZIP file for âall of New Mexico since the dawn of timeâ. The result is a whopping 712MB ZIP file.
Hereâs where I knew I was in trouble: the only thing inside was a single 38 GB file called wcproduction.xml.
Typing group by, Revisited
2020-04-29
If you wish to make an apple pie from scratch, you must first create the universe.
âCarl Sagan
âTypingâ group by
2020-04-28
A few weeks ago, chatting with some friends who also occupy the tiny intersection between engineers and programmers, the topic of âgroup byâ came up in the context of in-memory data management with Python.
Iâm known as a pandas hater and have managed to sway a few others to my view, so we were talking about how to translate the logic of SQLâs (or pandasâ) group by into the Python âtype systemâ.
Dashboard Confessional
2020-04-22
Many clients, friends, acquaintances, and (in the Before Times) strangers in bars have asked me over the years: what do I think about âbusiness intelligenceâ (BI) tools? These are applications which make it easy, without any custom programming required, to connect to data sources, visualize data, and create interactive analytics and âdashboardsâ.
What is object-oriented programming really about? Whatâs so special about âlate bindingâ? And why do I have to pass self around everywhere in Python? Weâll take a meandering path in todayâs post which will try to answer each of these questions, and build our own miniature object system along the way.
Oh, R. I canât tell you why âdata scientistsâ have switched, for the same reason I canât tell you how Santaâs reindeer achieve lift: I simply donât believe in them. But, I can tell you why I no longer use R for new projects.
POTD: âA Mathematican's Lamentâ
2017-12-07
Todayâs Paper of the Day continues this weekâs theme of âeducationâ; this time, with a research mathematician turned educatorâs thoughts on why K-12 math education ends up leaving so many graduates with negative feelings toward math.
I like this paper a lot, because it resonates so strongly with my own experience of middle- and high-school math. I had several great teachers, but somehow it all seemed like an exercise in memorization, at best, or obscurantist puzzle-solving, at worst: a sequence of parlor tricks; when you see this pattern, do this transformation (itâs called âintegration by partsâ, but you will not be required or encouraged to know where it came from or why it got the name).
POTD: âWhy Teach Programming Languages?â
2017-12-06
We continue our celebration (or perhaps examination) of Computer Science Education Week with todayâs POTD.
Many computer science programs include a course on âprogramming languagesâ; these take a lot of different forms, from a broad survey of various popular languages to in-depth studies of semantics and interpreter implementation. In todayâs POTD, Shivers argues for the importance of studying programming languages not just to computer science students, but to anyone who wants to understand the modern world.
Todayâs POTD continues our theme of Computer Science Education Week. Yesterday we saw a paper (and retraction), and meditated on the topic of why itâs so hard to teach programming.
What if part of the reason is that the way computer science topics are typically presented just isnât that interesting to students?
This week is Computer Science Education Week! Itâs an initiative I watch each year with a mix of admiration and dread; Iâm dead convinced that our society needs to expose more students to computer science, not fewer; that programming is getting more accessible and relevant, not less; that the only way to build diversity of experience and perspective downstream in industry and academia is to construct education programs that appeal to diverse populations upstream.
That said, Iâm not sure that Barack Obama or a movie star spending an hour writing a Javascript âhello worldâ program and getting an âI learned codeâ sticker does much to move that needle. Thereâs a fundamental tension: we want computer science to be accessible, but it is fundamentally hard: hard like algebra is hard. Everyone takes algebra, and as a society we see the value in teaching every student the power of abstracting from concrete arithmetic to symbolic manipulation. But we donât, generally, construct flashy multimedia initiatives to get kids to write ây = x + 2â on a sticky note and pretend thatâs all there is to it.
POTD: âUnskilled and Unaware of Itâ
2017-12-01
Todayâs POTD is a well-known classic in the genre of âsocial sciences research that confirms what weâve always suspected: people are terribleâ.
The Paper of the Day for today comes to us from the distant past: a time before venture capital firms would seemingly hurl trebuchet-loads of money at anyone with a â.aiâ domain name and the ability to spell âdeep learningâ. (Iâve been working on this long enough that my folder of papers on machine learning and data science is labeled âAIâ.)
Todayâs POTD presents a translation of a great tool from the functional programming community into the more mundane world of 90s-style object-oriented programming languages.
A recent discussion on the SPE discussion board inspired me to jot down some thoughts on how a young (or experienced!) petroleum engineerâor for that matter any other technically skilled non-programmerâmight best engage with âlearning to codeâ.