Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

18.4. What You've Learned

This chapter covered macro programming. You’ve learned the following:

  • Macros let you write code that writes code. With macros, you can create your own programming language and convert it to standard Lisp just before the compiler can get a peek at it.

  • Macros allow you to get rid of that feeling of déjà vu when writing your code, in situations when nothing else can do so.

  • You must be careful when writing macros so that they don’t lead to unintentional, repeated execution of code.

  • You need to be careful to avoid unintended variable capture in macros. You can avoid this by using gensym names.

  • If variables created by a macro are exposed on purpose, as a feature of the macro, the macro is called an anaphoric macro.

  • Macro programming is a very powerful technique. However, try to use functional programming instead to solve a problem whenever possible. Macros should always be a last resort.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint