4 ms·
Also, this bit: (->> justice-league (map #(:vehicles %)) (filter #(not (nil? %))) (flatten)) can be simplified to just `(mapcat :vehicle
by vlaaad 8y ago
Also, this bit:
(->> justice-league
(map #(:vehicles %))
(filter #(not (nil? %)))
(flatten))
can be simplified to just `(mapcat :vehicles justice-league)`
- adambard 8y agoA few notes on why this is so: - Keywords (i.e. `:vehicles`) can be used as getter functions, as covered in the OP. - mapcat (like most collection functions in clojure) treats `nil` as an empty sequence