title: Destructuring Maps in clojure -- unused keys
body: <p>I have defined a function which takes a map. I thought to use destructuring to access the values. However, I also want to check whether there are any used keys. </p>
  
  <p>So, for example something like...</p>
  
  <pre><code> (defun func1 [{:keys [a b c] :rest rest}]
      (println a b c)
      (println rest))
  
   (func1 {:a 1 :b 2 :c 3 :d 4})
  </code></pre>
  
  <p>which would print </p>
  
  <pre><code> 1 2 3
   4
  </code></pre>
  
  <p>The reason that I want this is that if rest is not null, this is probably an error, which I'd like to signal. I know about :as, which I could use. But then I need to store the list of valid keys twice. </p>
  
  <p>Am I missing something?</p>
  
  <p>Phil     </p>