-
-
Save Li-Bot/bb9b1b53f8ad38903eaaaccbd5d8efe3 to your computer and use it in GitHub Desktop.
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
Observable.from(fahrenheit) | |
.map({ (degreesFahrenheit) -> Double in | |
return (degreesFahrenheit - 32.0) / 1.8 | |
}) | |
.filter({ (degreesCelsius) -> Bool in | |
return degreesCelsius <= 20.0 | |
}) | |
.reduce(0.0, accumulator: ({ (result, degreesCelsius) -> Double in | |
return result + degreesCelsius | |
})) | |
.subscribe(onNext: { sum in | |
print(sum) | |
}) | |
.disposed(by: disposeBag) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment