What does HackerNews think of meander?

Tools for transparent data transformation

Language: Clojure

I can't speak to the quality of Zig's compile-time compilation, other than to comment and say the article is taking liberties with its use of the word unique. As other commenter's have noted, many languages have the feature. Instead I'm going to talk about a bunch of cool and weird compile-time code implemented by people much smarter than I.

If anyone reading this is interested in compile-time computation, you owe it to yourself to read Paul Graham (of HN)'s own work on compile time programming, "On Lisp"[0], or to take compile-time ideas to the next level, Doug Hoyte's "Let Over Lambda"[1] (LOL). Lisp languages have a long and interesting history of compile-time computation via their various macro systems, and given the first-class inclusion in most Lisps, a greater variety of ideas have been explored regarding compile-time computation.

A few interesting examples:

LOL's "Pandoric macro"[2] lets you monkey-patch closure values. It's absolutely bonkers and would almost certainly be pathological to introduce to a codebase, but it's an example of pushing the boundaries of what's possible.

Common Lisp's object system, implemented via macro[3]. To be honest, the entire Common Lisp language is a masterclass when it comes to learning about macros (I can't avoid mentioning Scheme's hygeinic macro system and Lisp-1/Lisp-2.)

A special non-Lisp shout-out goes to Rust's Diesel library for embedding SQL DDL queries into macros[4] which is not something I've personally seen before.

Clojure has a few interesting (and practical) macro libs, particularly core.async, which is an implementation of CSP (similar to Golang's channels AFAIK), it embeds perfectly into the existing language and extends its capabilities even though it's merely a library. Another interesting lib which comes to mind is Meander[5], which uses term-rewriting to provide transparent data transformations. Think declaratively interacting with data structures at compile time, and the library figuring out the best way of turning it into imperative value manipulation code.

[0] http://www.paulgraham.com/onlisp.html [1] https://letoverlambda.com/ [2] https://letoverlambda.com/index.cl/guest/chap6.html#sec_7 [3] https://mitpress.mit.edu/9780262610742/the-art-of-the-metaob... [4] https://diesel.rs/ [5] https://github.com/noprompt/meander

I'll also leave these here, in case the conversation inevitably turns to pattern-matched function definition in Elixir. :)

https://github.com/clojure/core.match -- pattern matching as a library

https://github.com/killme2008/defun -- using core.match to implement Elixir/Erlang-like function definition

https://github.com/noprompt/meander -- advanced pattern matching, for some fun and flavor :)

What's also fun is that core.match is implemented using a paper from INRIA on how to efficiently convert patterns into decision trees:

https://github.com/clojure/core.match/wiki/Understanding-the...

Sounds like declarative pattern matching which sounds just great to me [0].

I won't deny that XML sucks to write. But I'm not yet ready to throw the baby out with the bathwater.

Maybe we keep using XML as a machine-readable serialization format (and XSLT as serialization of pattern-matching data transformations!) and people use native data structures in their own programming languages. Or we all switch to S-expressions.

0: https://github.com/noprompt/meander

I think rewrite is related to program transformation [1]? Most stuff that I've seen looks pretty academic, obscure, not very well maintained, etc ...

Pure [2] is the only practical language I've stumbled upon that appears to be general purpose _and_ based on term rewrite.

I wonder if XSLT could fall under this umbrella? It rewrites trees into other trees ... not sure if that's enough to be considered a term rewrite system. If yes, then maybe CDuce is also an interesting thing to check.

The author of Ragel also has a program transformation system [4], but I'm not sure what state it is at, he seems to have been working on it for a long while but it doesn't seem to be something nearly as popular as Ragel.

Edit: I think specter [5] and meander [6] also could be, perhaps tangentially, related to rewriting. Meander expressly mentions rewrite as inspiration/fondation. Curiously these two look a lil bit like xpath/xslt but with EDN as data model instead of XML infoset.

--

1: https://en.wikipedia.org/wiki/List_of_program_transformation...

2: https://github.com/agraef/pure-lang

3: https://www.cduce.org/#whatis

4: http://www.colm.net/open-source/colm/

5: https://github.com/redplanetlabs/specter

6: https://github.com/noprompt/meander

Specter is tremendously useful and rarely lets on a case where it can’t perform a transformation. For ensuring that you’re getting the most efficient form of a transformation [0] it’s incredible —- and it is somewhat data-oriented, allowing easy saving and reuse of navigators.

Meander [1] is also wonderful. Its unification-based approach makes for nice expressions of intent. Its strategy-based approach to rewriting [2] is more flexible than most common walker libraries, too.

[0]: https://github.com/redplanetlabs/specter/wiki/Specter's-inli...

[1]: https://github.com/noprompt/meander

[2]: https://github.com/noprompt/meander/blob/epsilon/doc/strateg...

Meander: transparent data transformation library for Clojure/ClojureScript

https://github.com/noprompt/meander

I would argue Clojure gets close to it, especially in combination with Meander [0], a lib for declarative/functional data transformation.

Unfortunately, I don't know if Meander is used in any production systems.

[0] https://github.com/noprompt/meander