- Introduction to Functional Programming Johannes Weiß - https://vimeo.com/100786088
- ReactiveCocoa at MobiDevDay Andrew Sardone - https://vimeo.com/65637501
- The Future Of ReactiveCocoa Justin Spahr-Summers - https://www.youtube.com/watch?v=ICNjRS2X8WM
- Enemy of the State Justin Spahr-Summers - https://www.youtube.com/watch?v=7AqXBuJOJkY
- WWDC 2014 Session 229 - Advanced iOS Application Architecture and Patterns Andy Matuschak - https://developer.apple.com/videos/play/wwdc2014/229/
- Functioning as a Functionalist Andy Matuschak - https://www.youtube.com/watch?v=rJosPrqBqrA
- Controlling Complexity in Swift Andy Matuschak - https://realm.io/news/andy-matuschak-controlling-complexity/
This file contains hidden or 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
var a = 2 | |
var b = 4 | |
func add(x, y) { | |
return x + y | |
} |
This file contains hidden or 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
func add(x, y) { | |
return x + y | |
} |
This file contains hidden or 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
//Imperative Programming | |
var total = 0 | |
for i in 1...10 { | |
total += i | |
} | |
print("Imperative: total: ", total); // prints 55 |
This file contains hidden or 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
//Functional Programming | |
func sum(start: Int, end: Int, total: Int) -> Int { | |
if (start > end) { | |
return total; | |
} | |
return sum(start: start + 1, end: end, total: total + start) | |
} | |
print("Functional: total: ", sum(start: 1, end: 10, total: 0)); // prints 55 |
This file contains hidden or 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
struct Contact { | |
var firstName: String | |
var lastName: String | |
var email: String | |
var age: Int | |
var duration: Int | |
} |
This file contains hidden or 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 contacts = [ | |
Contact(firstName: "first", lastName: "1", email: "[email protected]", age: 20, courseDuration: 12), | |
Contact(firstName: "Second", lastName: "2", email: "[email protected]", age: 22, courseDuration: 16), | |
Contact(firstName: "Third", lastName: "3", email: "[email protected]", age: 30, courseDuration: 22) | |
] |
This file contains hidden or 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
//Get just the name of the contacts into a separate array | |
//Imperative Programming | |
var contactNamesImp = [String]() | |
for contact in contacts { // for each | |
contactNamesImp.append(contact.firstName) | |
} | |
print(contactNamesImp) |
This file contains hidden or 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
//Functional Programming | |
let contactNames = contacts.map({ | |
return $0.firstName + " " + $0.lastName | |
}) | |
print(contactNames) |
OlderNewer