Little victory lap down to the chocolate shop because the thing I've spent the week working on now works.


I'm working on a pattern-matching syntax and algorithm for mathematical expressions. Like an analogue of regular expressions, but for trees. I worked out the last few missing pieces while talking with someone at last week.

@christianp I occasionally have re-surface a parsing requirement that I feel should have been solved by someone, somewhere, and feels like it would be phenomenally useful, but I can never find a solution.

I should write up the requirement sometime so people can tell me why it will never work.

@christianp Sounds like that could potentially be applied to build a nice macro system for a lisp-like language. Or—I'm thinking out-loud as I'm writing—a nice foundation for a computer algebra package.

I'd love to hear more about it anyway.

@Colinvparker an abstract syntax tree. For example, a × (b+c) can be interpreted as a tree with × at the root

@christianp ok, so there’s a search syntax that would let me search for simple things like “b+c” or “a product involving a sum” or such?

@christianp and vs regular expressions I don’t have to spend a long time telling it to ignore parentheses if they’re redundant or other silliness?

Sign in to participate in the conversation

A Mastodon instance for maths people. The kind of people who make \(\pi z^2 \times a\) jokes.

Use \( and \) for inline LaTeX, and \[ and \] for display mode.