Created
March 22, 2010 18:46
-
-
Save cgrand/340375 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro ensure-node [nodes parent-selector tag transform-fn] | |
`(ensure-node* nodes (selector ~parent-selector) (selector [:> ~tag]) tag transform-fn)) | |
(defn ensure-node* [nodes parent-selector child-selector tag transform-fn] | |
(transform nodes parent-selector | |
(fn [elt] (let [content (:content elt) | |
content* (transform content child-selector transform-fn)] | |
(if (= content content*) ;; hmm no it would be better to use zip-select |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment