I bashed at the code some more today, and gradually got different parts of it more similar to each other. At this point, to go with the map-style functions I've written, I need a custom reduce-style function.
Here's what it needs to take:
- Reducing callable (in this case, Option.with_option)
- Dynamic value
- Keys to iterate over
- Initial value
The resulting Dynamic should have an instantiate defined by the function, a keys equal to the argument, and the maximal and flexible values carried over from the Dynamic argument.
Before I do that, I want to figure out some way to cut down on the size of the last big nested function.
I need to take some time to think about this (and play videogames).