Hi Greg,

I wrote a quickref to the AST node structures that also describes a generic 
method for traversing an arbitrary AST. It can be found here: 
http://mkremins.github.io/clojure-ast-ref

Essentially, the :children vector is an ordered list of keys into the AST node. 
Each of these keys is guaranteed to point to another AST node or vector of AST 
nodes – so you can look at :children to determine which of a node's keys 
themselves point to AST nodes, then visit the nodes at these keys as necessary.

I'm not yet entirely familiar with how the provided pre- and postwalk functions 
are used for AST traversal, but when last I checked they make use of this 
strategy internally. This allows generic walkers to ignore nodes they don't 
care about (i.e. simply not include any code to handle nodes of a particular 
type) while still being able to visit children of the ignored nodes.

Max

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to