What You've Learned

This chapter demonstrated how to create DSLs in Lisp. You learned the following:

  • When you need to do some weird programming for a very specific domain, Macros are a great solution. With them, you can create your own DSL.

  • Often, it makes sense to first write a helper function for a macro (like print-tag), and then write a macro (like tag) to add improvements that only a macro can provide. These improvements usually involve being able to access the code with a clearer, and often safer, syntax.

  • You can mix DSLs with regular Lisp code, which gives you a lot of power.

  • DSLs are useful when you need to write very specific code—whether it’s code for a web page, code that draws a picture, or code that builds special game commands.

Get Land of Lisp now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.