- Paperback: 120 pages
- Publisher: Pragmatic Bookshelf; 1 edition (September 5, 2014)
- Language: English
- ISBN-10: 1941222226
- ISBN-13: 978-1941222225
- Product Dimensions: 7.5 x 0.5 x 9.2 inches
- Shipping Weight: 8 ounces (View shipping rates and policies)
- Average Customer Review: 4 customer reviews
- Amazon Best Sellers Rank: #820,683 in Books (See Top 100 in Books)
Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
Mastering Clojure Macros: Write Cleaner, Faster, Smarter Code 1st Edition
Use the Amazon App to scan ISBNs and compare prices.
Frequently bought together
Customers who bought this item also bought
From the Publisher
Tips for Clojure Macros
As Clojure programmers, we use macros all the time, even if we don't write them ourselves. So understanding the details of how macros work is a time investment that pays off right away.
- As a first approximation, write macros only where functions won't do.
- Use syntax-quoting and gensyms to avoid accidental symbol capture.
- Keep track of whether a piece of code will be run at compile time or run time.
- Try writing the code you want to generate first (assuming specific inputs), and *then* the macro that expands to that code.
- If you have the input you need to do work at compile time, you may be able to use macros to speed up your app's runtime.
- Often macros can be replaced by higher-order functions using thunks (functions of no arguments), but you do lose some of the syntax benefits.
- Consider the assumptions a new user of your macro will make, and how you can make their jobs easier through error messages, documentation, or other tools.
- Read and understand the code for macros that you use from the Clojure language and other open-source libraries. It'll teach you a lot about what to do, and what to avoid.
About the Author
Colin Jones is a software craftsman at 8th Light, where he builds web, mobile, and desktop systems for clients large and small. He's an active participant in the Clojure open source community, including work on the Clojure Koans, REPLy, Leiningen, and small contributions to Clojure itself.
Author interviews, book reviews, editors picks, and more. Read it now
Top customer reviews
There was a problem filtering reviews right now. Please try again later.
more importantly, many reasons *why* you would want to write macros. Even the footnotes were quite interesting.
Very well written book and examples will have you grokking this core and integral facet within minutes.