Hacker News new | ask | show | jobs
by sterlind 789 days ago
Term rewriting is woefully overlooked, maybe because the paradigm is rather open-ended. Questions about fixed or variable arity, what rules to apply in what order, what kinds of pattern matching to support, can make the language very limited or intractably inefficient depending on the answer.

I like that Modal just rolls with Peano arithmetic rather than awkwardly bolting on numerics. It's impractical, but it doesn't have to be practical - this is an exploration of a concept

1 comments

What's nice about rewriting as a concept is that bolt-on extensions to make things fast don't have to be awkward.

Built-in rules that take priority over user-defined ones, as well as special variables in Devine's implementation, allow us to gain back speed while retaining some idea of purity. We know these operations can be phrased in terms of rewrite rules, so let's shortcut them and use built-in arithmetic in place.

You'd never know the difference! There's also a lovely arithmetic library built by d6 that you may enjoy. It does arithmetic digit-by-digit, and they're continually improving it to run faster.

https://git.phial.org/d6/modal/raw/branch/d6/binary/arith.mo...