diff --git a/0006-functional-setters/Functional Setters.playground/Pages/02-Exercises.xcplaygroundpage/Contents.swift b/0006-functional-setters/Functional Setters.playground/Pages/02-Exercises.xcplaygroundpage/Contents.swift index 08022755..aa766d39 100644 --- a/0006-functional-setters/Functional Setters.playground/Pages/02-Exercises.xcplaygroundpage/Contents.swift +++ b/0006-functional-setters/Functional Setters.playground/Pages/02-Exercises.xcplaygroundpage/Contents.swift @@ -5,32 +5,42 @@ */ // TODO /*: - 2. Take the following `User` struct and write a setter for its `name` property. Add another property, and add a setter for it. What are some potential issues with building these setters? - */ + 2. Take a `struct`, _e.g._: + +``` struct User { let name: String } +``` + + Write a setter for its property. Take (or add) another property, and add a setter for it. What are some potential issues with building these setters? + */ // TODO /*: - 3. Add a `location` property to `User`, which holds a `Location`, defined below. Write a setter for `userLocationName`. Now write setters for `userLocation` and `locationName`. How do these setters compose? - */ + 3. Take a `struct` with a nested `struct`, _e.g._: + +``` struct Location { let name: String } -// TODO -/*: - 4. Do `first` and `second` work with tuples of three or more values? Can we write `first`, `second`, `third`, and `nth` for tuples of _n_ values? + +struct User { + let location: Location +} +``` + + Write a setter for `userLocationName`. Now write setters for `userLocation` and `locationName`. How do these setters compose? */ // TODO /*: - 5. Write a setter for a dictionary that traverses into a key to set a value. + 4. Do `first` and `second` work with tuples of three or more values? Can we write `first`, `second`,`third`, and `nth` for tuples of _n_ values? */ // TODO /*: - 6. Write a setter for a dictionary that traverses into a key to set a value if and only if that value already exists. + 5. Write a setter for a dictionary that traverses into a key to set a value. */ // TODO /*: - 7. What is the difference between a function of the form `((A) -> B) -> (C) -> (D)` and one of the form `(A) -> (B) -> (C) -> D`? + 6. What is the difference between a function of the form `((A) -> B) -> (C) -> (D)` and one of the form `(A) -> (B) -> (C) -> D`? */ // TODO