Here's an example from Stuart Halloway's book.

(defmacro chain
  ([x form] (list '. x form))
  ([x form & more] (concat (list 'chain (list '. x form)) more)))

(macroexpand '(chain arm getHand getFinger getNail) ; I added the getNail part.

The result is (. (. (. arm getHand) getFinger) getNail)

I'm having trouble understanding how this works.
In the first call, x is arm, form is getHand, and more is '(getFinger
getNail), right?
I expected that more would be processed recursively, but it seems to
me that only form is processed recursively.
Somebody please straighten me out here.

-- 
R. Mark Volkmann
Object Computing, Inc.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to