Skip to content

Instantly share code, notes, and snippets.

@jrheard
Last active December 13, 2015 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrheard/16269f93dfc51d511792 to your computer and use it in GitHub Desktop.
Save jrheard/16269f93dfc51d511792 to your computer and use it in GitHub Desktop.
(defn childreno [node children]
(fresh [r]
(resto node r)
(resto r children)))
(defn nodes-existo [condition nodes out]
(fresh [node remaining-nodes]
(conso node remaining-nodes nodes)
(conde
[(condition node) (== node out)]
[(fresh [children]
(childreno node children)
(nodes-existo condition children out))]
[(nodes-existo condition remaining-nodes out)])))
(defn get-elements-by-class-name [dom class-name]
(run* [q]
(nodes-existo #(has-classnameo % class-name) dom q)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment