1.0.0-SNAPSHOT permalink Arrow_down_16x16



  • (zip-select-fragments* locs state-from state-to)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source net/cgrand/enlive_html.clj:506 top

(defn zip-select-fragments* [locs state-from state-to]
  (letfn [(select1 [locs previous-state-from previous-state-to] 
            (when (and previous-state-from previous-state-to)
              (let [states-from (map #(step previous-state-from %) locs)
                    states-to (map #(step previous-state-to %) locs)
                    descendants (reduce into []
                                  (map #(select1 (children-locs %1) %2 %3) 
                                    locs states-from states-to))]
                (loop [fragments descendants fragment nil 
                       locs locs states-from states-from states-to states-to]
                  (if-let [[loc & etc] (seq locs)]
                    (if fragment
                      (let [fragment (conj fragment loc)]
                        (if (accept-key (first states-to))
                          (recur (conj fragments fragment) nil etc 
                            (rest states-from) (rest states-to))
                          (recur fragments fragment etc 
                            (rest states-from) (rest states-to))))
                      (if (accept-key (first states-from))
                        (recur fragments [] locs states-from states-to)
                        (recur fragments nil etc 
                          (rest states-from) (rest states-to))))
    (select1 locs state-from state-to)))
Vars in net.cgrand.enlive-html/zip-select-fragments*: defn letfn
Used in 0 other vars

Comments top

No comments for zip-select-fragments*. Log in to add a comment.