my function returns some vectors inside list and I need to escape from that list and return vectors.
My main function works like that and return vector inside list.
(defn destruct-cart-items [my-cart]
(for [[user product stock-amount] my-cart]
[:tr [:td user] [:td product] [:td stock-amount]]
)
)
=>
([:tr [:td "bar"] [:td "mammut"] [:td 1]]
[:tr [:td "bar"] [:td "mammut"] [:td 1]]
[:tr [:td "bar"] [:td "mammut"] [:td 1]]
[:tr [:td "bar"] [:td "mammut"] [:td 1]])
I need return vectors like that--->
[:tr [:td "bar"] [:td "mammut"] [:td 1]]
[:tr [:td "bar"] [:td "mammut"] [:td 1]]
[:tr [:td "bar"] [:td "mammut"] [:td 1]]
[:tr [:td "bar"] [:td "mammut"] [:td 1]]
How can I do that in different ways?
Why I need like that
(clerk/html [:table
[:tr [:th "User"] [:th "Product"] [:th "Stock Amount"]]
(destruct-cart-items @!my-cart)])
I will use returned data inside the HTML element.
You can also use unquote-splicing:
(clerk/html `[:table
[:tr
[:th "User"]
[:th "Product"]
[:th "Stock Amount"]]
~@(destruct-cart-items @!my-cart)])