AI
(:text) => :textSize: a a a
AI
(:text) => :textAI
AI
AG
ST
(let [m (group-by (comp keyword :type)
(get-in value [:organization :resource :address]))]
(-> (or (:physical m) (:postal m)) first :text))
ST
AG
AI
ST
[{:text "123" :type "postal"}
{:text "789" :type "physical"}]ST
[{:text "123" :type "postal"}
{:text "789" :type "physical"}]ST
ST
(or
(->>
(get-in value [:organization :resource :address])
(some #(when (#{"physical"} (:type %)) %))
(:text))
(->> (get-in value [:organization :resource :address])
(some #(when (#{"postal"} (:type %)) %))
(:text)))
or засунуть в some, чтобы находилось за один проход, конечноAI
ST
ST
AG
AI
(loop [physical nil
postal nil
[{:keys [type text]} :as r] (get-in value [:organization :resource :address])]
(cond
physical physical
(empty? r) postal
:else (recur ({"physical" text} type)
(or postal ({"postal" text} type))
(rest r))))
IG
AG
KC