The final version of Scala 2.10 was released on January 4, 2013. Martin Christensen, a visiting scholar in our department, and myself have been playing with some of the new features, and I'll be blogging about some of our discoveries in my copious spare time.

Today, I'll show you how to write a simple macro in Scala. You may have seen macros in C, such as #define swap(x, y) { int temp = x; x = y; y = temp; }

C macros are just text substitutions. If you callswap(first, last), the result is