meander 2021-08-29

Unrelated to my other project, I'm evaluating pattern matching in an open world context based on something like best-fit. Meander is a macro in current design, is there a version where pattern matching is compiled to a value that's run through an interpreter of some kind? My thinking is to avoid eval after adding a new pattern, sorting and compiling.

meander.interpreter.epsilon

Unrelated to meander but here's my attempt to create macro-free pattern matching library https://github.com/xapix-io/matchete

👍 1

@huxley that's great, thanks. I'd missed that!

@delaguardo I considered matchete but I'm unclear on the performance characteristics. Meander has a lot of optimizations in reducing redundant checks.

however the interpreter is rather difficult to use and the performance sucks

meander's super optimizations have no way of working on runetime

Oh, that's a shame @huxley. I'd hoped it'd be possible to do analysis on the forms to determine redundant paths... The machinery for those optimizations is all there, so perhaps that's possible in a future update.

The performance of the interpreter can be improved. It probably will never get as close to the performance of the compiled code but it can get closer. At the moment, I don’t think the interpreter does any optimizations. Since the interpreter is built e.g. it “compiles” a function, it is possible to eliminate many redundancies.