While looking for something completely unrelated, I stumbled upon this presentation
that demonstrates LINQ query functionality in Java using Quaere and by adding the same/similar functionality using macros in Ruby and Clojure. The example query selects strings of length 5 from an array, upcases and sorts the result set. Pretty basic stuff. If anyone has a better example query, I'd be interested in hearing about it.
The LINQ version of the query resembles SQL, but the select "clause" is at the end of the query. The other examples do things in the same order... no biggie.
Frankly, the Quaere version of the query is ugly enough that I would actually be reluctant to use it, which is a shame because it might be a capable query framework (-- I'm assuming that is what people are calling them). I hate ugly code. It's not only painful to review, but also harder to remember.
The Ruby version was implemented using a macro, and the query is rather elegant looking; however, the macro code is horrible. At one point, I thought that I might want to add Ruby to my tool belt... after reviewing the language a bit more, I think that they should rename it COAL, because it sure as hell doesn't remind me of a ruby.
In contrast to the Ruby implementation, the Clojure query is a bit less clear (at least to my eye -- I haven't taken it upon myself to learn Clojure yet), but the actual macro is light-years more understandable (3 SLOC vs 40 or 50 SLOC). This is appears to be the biggest complaint about Ruby from Lisp folks -- the macro system is horribly broken when you try to do some pretty basic things with it.
Anyways, as I mentioned before, this query is brain dead simple and I probably wouldn't write a macro unless I was going to be performing this type of query pretty darn frequently. Below is the CL code for performing the same query -- I used a mapping function with write-to-string to save me the trouble of typing everything inside of double quotes.
CL-USER> (defvar names (mapcar #'write-to-string '(burke connor frank everett albert george harris david)))
CL-USER> (defvar query (sort (mapcan #'(lambda (x)
(if (= (length x) 5)
(list (string-upcase x)))) names)
("BURKE" "DAVID" "FRANK")