2

So I have finally realized that I can use selectors to limit the portions of the page nodes that enlive transforms, that way I can create vectors of non-intersecting nodes.

Lots of words to say:

(defn b-content-transform []
  (def b-area (eh/select global-page [:.b])) ;;cuts out all irrelevant nodes

  (eh/transform b-area [:.b]
    (eh/clone-for [i (range numberOfB)] 
        (eh/content (b-sample-content i)))))

So this returns something like..

[{:tag :div, :attrs {:class "b"}, :content ({:tag :div, :attrs {:id "b0", :class "topB"}]

Which is excellent, enlive nodes yay!

Now I have several transforms that act the same way.

My question is: how can I mash all the resultant vectors (?) together?

sova
  • 5,468
  • 10
  • 40
  • 48

1 Answers1

2

Well it turns out there is a knee-slappingly simple solution:

(concat transform1 transform2 transform3)

then enlive-html/emit* .

ntalbs
  • 28,700
  • 8
  • 66
  • 83
sova
  • 5,468
  • 10
  • 40
  • 48
  • 2
    (conj t1 t2 t3) is also usable, the difference is that conj can be lazy (evaluating the expressions only when needed) ... in this case they both work, based on some talk on #clojure (conj x y z) is the preferred invokation. – sova Feb 24 '15 at 01:27