We discuss partial application and how it might be used in your code. We show several examples that cover the syntax and usage of partial application in Swift.
- [Instructor] The first advanced concept…I'll introduce you to is called partial application.…In simple terms, partial application…is when we take a function that has…more than one argument and we fix one…of those arguments to a set value,…producing a function that has one less argument.…So what does this look like in code?…If you remember, this is the same kind of thing…that we did in our discussion about returning functions.…Let's imagine that we have a simple add function…that takes three numbers as arguments…and adds them together.…That will look like this, function, add,…our first argument, it's an integer.…
Our second argument is an integer,…and our third argument is an integer.…And finally, our function is going to return an integer.…And inside our function, we return x plus y plus z,…all three of our arguments added together.…What if we wanted to fix one of these arguments…to a certain number so that we only…had to pass in two arguments later on?…What that would look like is this:…we create a function, we'll call it addX,…
- 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.