This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
99 bottles of beer on the wall, 99 bottles of beer. | |
Take one down and pass it around, 98 bottles of beer on the wall. | |
. | |
. | |
. | |
1 bottle of beer on the wall, 1 bottle of beer. | |
Take one down and pass it around, no more bottles of beer on the wall. | |
No more bottles of beer on the wall, no more bottles of beer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check out the talk: https://talk.objc.io/episodes/S01E01-networking (Part 1) | |
// the talk uses swift 2 and I follow along by writing it in swift 3. | |
import Foundation | |
import PlaygroundSupport | |
//extension Sequence { | |
// public func failingFlatMap<T>(_ transform: @noescape(Self.Iterator.Element) throws -> T?) rethrows -> [T]? { | |
// var result: [T] = [] | |
// for element in self { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precedencegroup RangePattern { | |
associativity: left | |
lowerThan: RangeFormationPrecedence | |
} | |
infix operator .. : RangePattern | |
extension Float { | |
var samePrecision: Float { | |
return Float(description) ?? 0.0 | |
} | |
} |