Skip to content

Instantly share code, notes, and snippets.

@jsl
Created January 11, 2013 23:03
Show Gist options
  • Save jsl/4514711 to your computer and use it in GitHub Desktop.
Save jsl/4514711 to your computer and use it in GitHub Desktop.
(defn all-functions
([root-n] (all-functions root-n []))
([cur fns]
(if (= java.util.ArrayList (class cur))
(if (empty? cur)
fns
(map #(all-functions % fns) cur))
(if (= org.jruby.ast.DefnNode (class cur))
(all-functions (.childNodes cur) (conj fns cur))
(all-functions (.childNodes cur) fns)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment