title: Clojure style / idiom: creating maps and adding them to other maps
body: <p>I'm writing a Clojure programme to help me perform a security risk assessment (finally gotten fed-up with Excel).</p>
  
  <p>I have a question on Clojure idiom and style.</p>
  
  <p>To create a new record about an asset in a risk assessment I pass in the risk-assessment I'm currently working with (a map) and a bunch of information about the asset and my make-asset function creates the asset, adds it to the R-A and returns the new R-A. </p>
  
  <pre><code>(defn make-asset
    "Makes a new asset, adds it to the given risk assessment
    and returns the new risk assessment."
    [risk-assessment name description owner categories
     &amp; {:keys [author notes confidentiality integrity availability]
        :or   {author "" notes "" confidentiality 3 integrity 3 availability 3}}]
    (let [ia-ref (inc (risk-assessment :current-ia-ref))]
      (assoc risk-assessment
        :current-ia-ref ia-ref
        :assets (conj (risk-assessment :assets)
                      {:ia-ref ia-ref
                       :name name
                       :desc description
                       :owner owner
                       :categories categories
                       :author author
                       :notes notes
                       :confidentiality confidentiality
                       :integrity integrity
                       :availability availability
                       :vulns []}))))
  </code></pre>
  
  <p>Does this look like a sensible way of going about it?</p>
  
  <p>Could I make it more idiomatic, shorter, simpler?</p>
  
  <p>Particular things I am thinking about are:</p>
  
  <ul>
  <li>should make-asset add the asset to the risk-assessment? (An asset is meaningless outside of a risk assessment).</li>
  <li>is there a simpler way of creating the asset; and</li>
  <li>adding it to the risk-assessment?</li>
  </ul>
  
  <p>Thank you</p>