Turns a nested Clojure map into a flat (deps=1) map with concatenated attributes representing the original nesting.
(requre '[iku000888.map.crusher :refer [crush])
(crush {:foo {:bar ["baz"]}
:works {:with [:values :in :seq :if :primitive]}})
=>
{:foo.bar ("baz"),
:works.with (:values :in :seq :if :primitive)}
This 'works' on nested vector values with the assumption that the values in the vector is homogenous. In particular the result at a glance may not conform to intuition if the algorithm encounters something like this. However, this is by design to only contain primitive or seq of primitive values in the resulting map. (Otherwise the result is a nested map.)
(crush {:weird [:looking
{:if {:mix [:match :primitives {:in :seq}]}}]})
=>
{:weird.if.mix.in (:seq),
:weird.if.mix (:match :primitives),
:weird (:looking)}