I am very very interested in Macros and just beginning to understand its true power. Please help me collect some great usage of macro systems.
So far I have these constructs:
Pattern Matching:
Andrew Wright and Bruce Duba. Pattern matching for Scheme, 1995
Relations in the spirit of Prolog:
Dorai Sitaram. Programming in schelog. http://www.ccs.neu.edu/home/dorai/schelog/schelog.html
Daniel P. Friedman, William E. Byrd, and Oleg Kiselyov. The Reasoned Schemer. The MIT Press, July 2005
Matthias Felleisen. Transliterating Prolog into Scheme. Technical Report 182, Indiana University, 1985.
Extensible Looping Constructs:
Sebastian Egner. Eager comprehensions in Scheme: The design of SRFI-42. In Workshop on Scheme and Functional Programming, pages13–26, September 2005.
Olin Shivers. The anatomy of a loop: a story of scope and control. In International Conference on Functional Programming, pages 2–14, 2005.
Class Systems:
PLT. PLT MzLib: Libraries manual. Technical Report PLT-TR2006-4-v352, PLT Scheme Inc., 2006. http://www.plt-scheme.org/techreports/
Eli Barzilay. Swindle. http://www.barzilay.org/Swindle.
Component Systems:
Ryan Culpepper, Scott Owens, and Matthew Flatt. Syntactic abstraction in component interfaces. In International Conference on Generative Programming and Component Engineering, pages 373–388, 2005
Software Contract Checking
Matthew Flatt and Matthias Felleisen. Units: Cool modules for HOT languages In ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 236–248, 1998
Oscar Waddell and R. Kent Dybvig. Extending the scope of syntactic abstraction.In Symposium on Principles of Programming Languages, pages 203–215, 199
Parser Generators
Scott Owens, Matthew Flatt, Olin Shivers, and Benjamin McMullan. Lexer and parser generators in Scheme. In Workshop on Scheme and Functional Programming, pages 41–52, September 2004.
Tools for Engineering Semantics:
Matthias Felleisen, Robert Bruce Findler, and Matthew Flatt. Semantics Engineering with PLT Redex. MIT Press, August 2009.
Specifications of Compiler Transformations:
Dipanwita Sarkar, Oscar Waddell, and R. Kent Dybvig. A nanopass framework for compiler education. Journal of Functional Programming,15(5):653–667, September 2005. Educational Pearl.
Novel Forms of Execution
Servlets with serializable continuations Greg Pettyjohn, John Clements, Joe Marshall, Shriram Krishnamurthi, and Matthias Felleisen. Continuations from generalized stack inspection. In International Conference on Functional Programming, pages216–227, 2005.
Theorem-Proving System
Sebastian Egner. Eager comprehensions in Scheme: The design of SRFI-42. In Workshop on Scheme and Functional Programming, pages 13–26, September 2005.
Extensions of the Base Language with Types
Sam Tobin-Hochstadt and Matthias Felleisen.The design and implementation of typed scheme. In Symposium on Principles of Programming Languages, pages 395–406, 2008.
Laziness
Eli Barzilay and John Clements. Laziness without all the hard work:combining lazy and strict languages for teaching. In Functional and declarative programming in education, pages 9–13, 2005.
Functional Reactivity
Gregory H. Cooper and Shriram Krishnamurthi. Embedding dynamic dataflow in a call-by-value language. In European Symposium on Programming, 2006
Reference:
Collected from Ryan Culpepper's Dissertation
A macro is typically used to replace a repetitive series of keyboard and mouse actions and used often in spreadsheets and word processing applications like MS Excel and MS Word. The file extension of a macro is commonly .
If you have tasks in Microsoft Excel that you do repeatedly, you can record a macro to automate those tasks. A macro is an action or a set of actions that you can run as many times as you want. When you create a macro, you are recording your mouse clicks and keystrokes.
A macro is a series of commands and instructions that you group together as a single command to accomplish a task automatically. Newer versionsOffice 2007. Word for the web. To save time on tasks you do often, bundle the steps into a macro.
When you record a macro, the macro recorder records all the steps in Visual Basic for Applications (VBA) code. These steps can include typing text or numbers, clicking cells or commands on the ribbon or on menus, formatting cells, rows, or columns, or even importing data from an external source, say, Microsoft Access.
Culpepper & Felleisen, Fortifying Macros, ICFP 2010
Culpepper, Tobin-Hochstadt and Felleisen, Advanced Macrology and the Implementation of Typed Scheme, Scheme Workshop 2007
Flatt, Findler, Felleisen, Scheme with Classes, Mixins, and Traits, APLAS 2006
Herman, Meunier, Improving the Static Analysis of Embedded Languages via Partial Evaluation, ICFP 2004
Shivers, Carlstrom, Gasbichler & Sperber (1994 & later) The Scsh Reference manual.
Has a lot of good examples of using macros to embed mini-languages into Scheme. Introduced me to the technique of defining macros that implicitly quote their argument. Look at the use of process forms, regular expressions, and the awk-like mini-languages. Scsh is my recommendation as a starting point for playing with macros.
Hilsdale & Friedman (2000) Writing Macros in Continuation-Passing Style.
Shows how the weak syntax-rules macros can be made powerful using continuation-passing style. Gives plenty of examples.
Flatt, Culpepper, Darais & Findler (submitted) Macros that Work Together - Compile-Time Bindings, Partial Expansion, and Definition Contexts.
Provides an overview of, and semantics for the approach to macros in Racket/PLT Scheme. Not a whole lot of examples, but I think the paper has something you are looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With