Fork me on GitHub

What other libraries in Clojure are developed based on the data-driven pattern? I'm watching a data-driven programming youtube from by @rafd And get the idea that generic data structures > code (macros, functions). And the author also list many examples: • HoneySql • regal • compojure(based on macro) -> reitit (data) • JSX(text) -> Reagent (data) • SCSS(text) -> Garden (data) • GraphQL(text) -> EQL (data) • clojure.spec(macro) -> malli I did feel the interesting aspect of being data-driven. Literally speaking, what we always see starts from keywords (perhaps my conclusion is not rigorous). At the same time, I also want to know if Clojure's function libraries have generally undergone this change (besides what was mentioned above), that is, which other function libraries are also based on a data-oriented approach.


Raising this question is also to confirm whether there is a consensus in the Clojure community that Macros are not welcomed?


Clojure consensus is to use macros when necessary and otherwise avoid them. This is in contrast to Common Lisp's (over?-) enthusiasm for macros (and even changing the reader in ways Rich decided not to make possible).


Programming Clojure by Alex Miller with Stuart Holloway and Aaron Bedra has nicely memorable, systematic approach: > The first rule of Macro Club is, Don't Write Macros. Macros are complex. If you can avoid that complexity, you should. > The second rule of Macro Club is, Write Macros If That Is the Only Way to Encapsulate a Pattern....The exception to the rule is that you can write any macro that makes life easier for your callers when compared with an equivalent function. (slightly paraphrased from p187 & p199) They outline some scenarios where macros are justified: conditional evaluation, defining vars, java interop, postponing evaluation, wrapping evaluation, and avoiding a lambda.

👍 3

Re: "what we always see starts from keywords" , in the Clojure context, "data" is Clojure vanilla data-types and structures (~EDN), so, numbers, strings, keywords, vectors, sets, etc.; in another language, say JS, it would be more restricted. Another way I think of it is, data is whatever can be easily written, serialized/deserialized, and manipulated.

👍 1