We discuss the first main concept of functional programming, immutability and avoiding state change, which can be very helpful in preventing bugs and maximizing maintainability
- [Instructor] The first major concept…of functional programming is one that may surprise…a lot of people.…This is the concept of immutability.…Most programmers learned early on that you could assign…a value to a variable then later on change the value…of that variable.…However, in functional programming this generally…isn't allowed.…In fact, many functional programming languages…such as Haskell and LISP prohibit it completely.…But in most real-world applications we settle…for simply keeping it to a minimum.…In short, immutability means that most of the values…in a program are constant, which in Swift means…using the let key word instead instead of the var key word.…
Another way to think about it is that in object-oriented…languages we assign values to variables.…A variable, say X, can be thought of as a container…that we can put different values into.…At one point in time X might hold the value of three,…at another point it might hold the value of 10,…at another point it might be negative four, and so on.…In functional programming, we don't assign, we define.…
- What is functional programming?
- Keeping functions and data separate
- First-class functions
- Working with arrays functionally
- Filtering and reducing
- Partial-application and recursion
Skill Level Intermediate
Swift 4: Protocol-Oriented Programmingwith Károly Nyisztor1h 44m Intermediate
Swift: Delegations and Data Sourceswith Steven Lipton1h 6m Intermediate
Swift: Writing Reusable Frameworkswith David Okun1h 49m Intermediate
1. What Is Functional Programming?
2. First-Class Functions
3. Array Functions
4. Advanced Functional Concepts
Next steps1m 1s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.