My Clojure/West talk covers how to write such a pass, and the comments on
this video include a link to the source code.

https://www.youtube.com/watch?v=KhRQmT22SSg


On Tue, May 13, 2014 at 1:16 PM, Max Kreminski <[email protected]>wrote:

> 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 [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to