O'Reilly logo

Clojure for Domain-specific Languages by Kelker Ryan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making our most important macro

There are some macros that need to be made to help hide some of the complexities of our DSL. If it's not already open, open the tdsl/src/tdsl/core.clj file in your favorite Clojure code editor. The following code and explanations will be additions to the core.clj file.

The deftwitter macro will parse a Twitter configuration file, create a new Twitter instance with this configuration, and then bind the instance to a Clojure symbol. Before making this macro, let's see what the Java interoperation pattern would look like without this macro.

If you're using an already opened REPL session, depending on your development environment you'll have to close the session and open a new one so that the session can see the new dependency ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required