title: How to walk an AST with tail recursion in Clojure
body: <p>I have an ANTLR3 AST which I need to traverse using a post-order, depth-first traversal which I have implemented as roughly the following Clojure:</p>
  
  <pre><code>(defn walk-tree [^CommonTree node]
    (if (zero? (.getChildCount node))
      (read-string (.getText node))
      (execute-node
        (map-action node)
        (map walk-tree (.getChildren node)))))))
  </code></pre>
  
  <p>I would like to convert this to tail recursion using loop...recur, but I haven't been able to figure out how to effectively use an explicit stack to do this since I need a post-order traversal.</p>