Fork me on GitHub
#code-reviews
<
2017-05-15
>
jimmy08:05:24

Hi guys, is there a better way to write nested map in clojure(script) ?

(defn general-table-row-ui
  [rows]
  (->> rows
       (map (fn [x]
              (d/tr
               {}
               (->> x
                    (map (fn [[_ val]]
                           (d/td {} val)))))))))

tap09:05:18

Maybe for produces a better-shape source code for this case.

(for [r rows]
  (d/tr {} 
    (for [[_ v] r]
      (d/td {} v))))