Coding 2021-12-24

By Max Woerner Chase

Okay, I've put together a rough draft of the accumulator and adaptor stuff. It was a bit annoying to get the necessary actions together. I ended up with nested functions like:

def instantiate(
    objects: _objects.Objects,
    items: _items.Items
) -> _requirements.Requirements[
    _io.Input[_cmd.PathStr]
]:
    return (
        yield from self.dynamic.instantiate(
            objects, items
        )
    ).map(
        lambda path_str: self.accumulator(
            adaptor.adaptor(
                items[adaptor.key]
            ),
            path_str
        )
    )

Except a little less skinny, because I reformatted that to try to fit in the code box.

There is a ridiculous amount of stuff going on there. The whole function conforms to the DynamicFunc[Input[PathStr]] interface, and relies on the wrapped value being a Dynamic[Input[PathStr]], so it can produce the actual value, and then use Input's map method to adapt the Input's wrapped value with a partial call of the accumulator field function, with the dynamic value corresponding to the adaptor's key, adapted by the adaptor.

This is all to say that this code had better work, after all the trouble I went through writing it.

I'm not going to try to use this code just yet, but I should get on that in the next few days.

I'm going to wrap up now before I stay up too late again.

Good night.