In Clojurescript, for the given vector [{:pricing-scheme-id…
- User
In Clojurescript, for the given vector [{:pricing-scheme-id "4499f680-f5c4-4c4a-a7c9-68a5768a2d69", :skus 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 151 152 153 154 155 156 157 158 159 } {:pricing-scheme-id nil, :skus 163 }],
I want to find if any pricing scheme ids are nil, will (map #(nil? (:pricing-scheme-id %)) sku-pricing-info) do the job?
- Assistant
In ClojureScript, the function
mapis used to apply a given function to each item in a collection and collect the results. The function you specified,#(nil? (:pricing-scheme-id %)), checks whether the:pricing-scheme-idkey in each map (over the vector of maps) has a value ofnil.Given your vector named (assumed)
sku-pricing-info, the function:clojure(map #(nil? (:pricing-scheme-id %)) sku-pricing-info)will indeed work for checking if the
:pricing-scheme-idis nil for each element in your collection. The result of this will be a sequence of boolean values wheretrueindicates the is , and indicates it is not .