January 2020
Intermediate to advanced
470 pages
11h 13m
English
There's another way to get and set values, which goes by the name of optics, including lenses and prisms (which we'll look at later in this chapter). What are lenses? They are functional ways of focusing (another optical term!) on a given spot in an object so that we can access or modify its value in a non-mutating way. In this section, we'll look at some examples of usage of lenses and consider two implementations: first, a simple one based on objects, and then a more complete one that's interesting because of some of the techniques we will be using.