Last active
August 29, 2015 14:22
-
-
Save motokiee/7d1111d2dd5522d16f47 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
let numbers = [0,1,2,3,4,5] | |
var sum = { (a:Int, b:Int) -> Int in | |
a + b | |
} | |
var odd = { (number:Int) -> Bool in | |
number % 2 != 0 | |
} | |
var multiply = { (number:Int) -> Int in | |
number * 2 | |
} | |
numbers.reduce(0, combine: sum) | |
numbers.filter(odd) | |
numbers.map(multiply) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment