News for hackers. Stuff that matters.
Re:The Magic of Partial Evaluation by iFreilicht on Wednesday November 18, 2026 @05:20PM (#50553079)
Very interesting concept! It reminds me of Hazel (https://hazel.org/) which takes the idea further and into the editor; any program written in it can be partially evaluated, even if variables or even part of the syntax are missing. Missing parts are called "holes", and those are preserved during evaluation so that something like

abs( + 2 * 3 - 10)

becomes

abs( - 4)

which is great fun. My first attempts using this showed me that if you're not used to this, it actually gets pretty confusing quite quickly, but I guess it can be learned.

Re:The Magic of Partial Evaluation by fmbb on Wednesday November 18, 2026 @05:30PM (#50553239)
Is that a unary minus denoting a negative number or a binary minus yielding a function with one hole?
Re:The Magic of Partial Evaluation by dullcrisp on Thursday November 19, 2026 @12:13AM (#50556312)
Does it matter?
Re:The Magic of Partial Evaluation by mrgriffin on Thursday November 19, 2026 @04:52AM (#50558057)
I'm guessing that HN has swallowed some underscores. I've written them as $0 in the below:

> abs($0 + 2 * 3 - 10)

> becomes

> abs($0 - 4)

Re:The Magic of Partial Evaluation by Izkata on Thursday November 19, 2026 @09:02AM (#50560247)
For both of you: two spaces of indentation does code formatting, for example:

  abs(_ + 2 * 3 - 10)
https://news.ycombinator.com/formatdoc

Underscores don't do that though, so I'm not sure that's what was intended.

Re:The Magic of Partial Evaluation by Jtsummers on Thursday November 19, 2026 @10:50AM (#50561680)
Underscores are not swallowed by HN, the only (visible) character that can get stripped out will be *, you need to explicitly escape them in regular paragraphs (in code no escaping is needed) using ** or \*. If it's a lone * surrounded by white space or the only * next to other visible characters, then it will also survive. Otherwise you get italics*.