Twelve statements: Difference between revisions

Content added Content deleted
Line 3,297: Line 3,297:
import UIKit
import UIKit
import Foundation
import Foundation
internal enum PaddingOption {
internal enum PaddingOption {
case Left
case Left
Line 3,318: Line 3,317:
if n <= 0 {
if n <= 0 {
return []
return []
}
}
return Array(self[0..<Swift.min(n, self.count)])
return Array(self[0..<Swift.min(n, self.count)])
}
}
Line 3,329: Line 3,327:
return []
return []
}
}
return Array(self[n..<self.count])
return Array(self[n..<self.count])
}
}
Line 3,342: Line 3,339:
func zipWithIndex() -> Array<(Element, Int)> {
func zipWithIndex() -> Array<(Element, Int)> {
// let result = [(Element, Int)](zip(self, indices(self)))
let result = [(Element, Int)](zip(self, self.indices))
let result = [(Element, Int)](zip(self, self.indices))
// let result = [(Element, Int)](zip(indices,self.indices))

return result
return result
}
}
}
}
Line 3,359: Line 3,352:
value /= 2
value /= 2
}
}
//let result = binaryRepresentation.pad(element: 0, times: length-binaryRepresentation.count, toThe: .Right).reverse()
let result = binaryRepresentation.pad(element: 0, times: length-binaryRepresentation.count, toThe: .Right)
let result = binaryRepresentation.pad(element: 0, times: length-binaryRepresentation.count, toThe: .Right)
return result
return result
}
}