4 ms·
Brought back memories to over a decade ago with Mathematica. It's quite easy to pattern match simple expressions like: ``` expr = foo[bar[k], baz[V]]; expr /.
by primitivesuave 1y ago
Brought back memories to over a decade ago with Mathematica. It's quite easy to pattern match simple expressions like:
```
expr = foo[bar[k], baz[V]];
expr /. foo[x_, baz[y_]] :> {x, y}
```
But in real-world use cases, this paradigm quickly exposes some unhandled edge cases, or cases where the evaluation becomes prohibitively expensive. Nowadays I use TypeScript, and this has ignited some curiosity into finding out if TS does anything to optimize for this in type inference.
- asplake 1y agoThat’s kinda what brought unification to my attention. For my own education I’m writing a compiler for a simple ML-style language. Enjoying Pierce’s Types and Programming Languages meanwhile.