|
|
|
|
|
by brundolf
1302 days ago
|
|
This is what I always heard Lisp was best at. Instead of making totally new languages (with parsers, tooling, etc) you'd create little DSLs within your own code in the form of macros: come up with a "little language" for describing one part of your app, write a macro for it, and then it integrates smoothly with everything around it Whether or not you agree this philosophy is a good one, and whether or not you like Lisp specifically, I think we can all agree that macros (in whichever language) are a much better way to do it than creating a bunch of tiny languages from scratch. I was surprised not to see the word "macro" appear in the article at all |
|
A classic example comes from Peter Norvig's "Principles of Artificial Intelligence" wherein he defines a subset of English grammar as a data structure [1]:
He then goes on to define a function "generate" that uses the above to create simplistic English sentences.Additional rules can be added by a non-programmar so long as they understand how their domain logic has been mapped to Lisp.
[0] https://news.ycombinator.com/item?id=33705558
[1] https://github.com/norvig/paip-lisp/blob/main/docs/chapter2....