Value of type 'Range' has no member 'map' and ˝Type 'Matrix' does not conform to protocol 'Sequence'˝
<p>I am trying to convert <a href="https://github.com/huangenyan/MathSwift" rel="nofollow">MathSwift</a> to swift3 and some issues could not resolve as ˝Value of type 'Range' has no member 'map'˝:</p>

<pre><code>func toIntArray(index: MatrixIndexType) -&gt; [Int] {

if index is [Int] {
    return index as! [Int]
} else if let rangeIndex = index as? Range&lt;Int&gt; {
    return rangeIndex.map({$0})
} else if let intIndex = index as? Int {
    return [intIndex]
}
return []}
</code></pre>

<p>More issues appear like ˝Type 'Matrix' does not conform to protocol 'Sequence'˝</p>

<pre><code>extension Matrix: Sequence {

public func generate() -&gt; AnyIterator&lt;Double&gt; {
    var nextIndex = 0
    return AnyIterator&lt;Double&gt; {
        if nextIndex == self.elements.count {
            return nil
        }
        nextIndex += 1
        return self.elements[nextIndex]
    }
}}
</code></pre>