title: Swift 3 - Reduce an array to a dictionary with a count of unique elements
body: <p>I'm currently migrating a current project to Swift3 (from 2.3) and am having some issues with an extension I have for my Sequence type.
  The extension is designed to return a dictionary of unique values from the source array.
  i.e. <code>var myArray = ["Apple","Apple","Orange","Banana","Banana"]</code></p>
  
  <p>the ".freq" extension returns a dictionary in the following format.</p>
  
  <pre><code>["Apple":2,"Orange":1,"Banana":2]
  </code></pre>
  
  <p>Here is the current Swift 2.3 syntax, which works:</p>
  
  <pre><code>extension Sequence where Self.Iterator.Element: Hashable {
  
      func freq() -&gt; [Self.Iterator.Element: Int] {
          return reduce([:]) { ( accu: [Self.Iterator.Element: Int], element) in
              accu[element] = (accu[element]? + 1) ?? 1
              return accu
          }
      }
  }
  </code></pre>
  
  <p>The issue is the the line <code>accu[element] = (accu[element]? + 1) ?? 1</code> will not work in Swift 3, due to syntax changes: </p>
  
  <blockquote>
    <p>cannot assign through subscript: accu is a let constant</p>
  </blockquote>
  
  <p>I'm sure its probably an easy fix, but cannot seem to find a relevant example of how to do this in swift3.</p>