title: Clojure - destructuring array vs map
body: <p>Clojure has a very nice destructuring syntax, which works for both arrays and maps.</p>
  
  <p>I am often confused between the two, meaning I'm not sure which one to choose. When should I use maps as parameters, and when should use an array ?</p>
  
  <p>For instance, I came accross the following data, I want to pass a longitude and a latitude. I could pass it either as <code>{:lat 12 :lng 34}</code> or <code>[12 34]</code>, or as two parameters.</p>
  
  <p>Note : I don't use two parameters since I think it's nicer to have a <code>coords</code> binding.</p>
  
  <p>Then suppose I want to add new fields (precision, altitude, timestamp...), it seems that the advantage then goes to the map :</p>
  
  <ul>
  <li>An array doesn't seem very readable with more parameters (you have to look at the prototype to understand the destructuring and therefore the parameters used).</li>
  <li>In a map I can add new fields and printing it is self-descriptive (keys acts as labels).</li>
  </ul>
  
  <p>But then I often end up with functions taking a big <code>options</code> parameter as a map, with some unrelated sub-options. It feels a bit bloated, even with just 10 keys.</p>
  
  <p>So, when should I use map, and when should I use arrays in my function parameters ? What are the pro/cons in terms of readability/extensibility/performance ? Also, could <code>core.match</code> help in that case ?</p>