-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
state.append doesn't work unless read is specified #11
Comments
Reproducible example: from burr.core import action, State, ApplicationBuilder, default
@action(reads=["val"], writes=["list", "val"])
def append(state: State) -> tuple[dict, State]:
val = state["val"] + 1
result = {"val": val}
return result, state.append(list=result["val"]).update(val=val)
app = (
ApplicationBuilder()
.with_state(list=[], val=0)
.with_actions(append=append)
.with_entrypoint("append")
.with_transitions(
("append", "append", default),
)
.build()
)
old_state = app.state
assert old_state["list"] == []
*_, new_state = app.step()
assert new_state["list"] == [1]
*_, new_state = app.step()
assert new_state["list"] == [1, 2] |
Problem is in Trick here is to pass in the Ideas:
My instinct says (2) as the logic feels like it should be outside (an action should say what it wants and not grab it). Will see how complicated it is. |
This makes the function first-class, and runsa s ingle-step function/reducer. THe tricky thing here is with inheritance -- we have a `run` and an `update` but we don't call it as it subclasses `Action`. We will be cleaning this up shortly (insomuch as we can) and thinking through the abstraction soon. This is a solution for #11
This makes the function first-class, and runsa s ingle-step function/reducer. THe tricky thing here is with inheritance -- we have a `run` and an `update` but we don't call it as it subclasses `Action`. We will be cleaning this up shortly (insomuch as we can) and thinking through the abstraction soon. This is a solution for #11
This makes the function first-class, and runsa s ingle-step function/reducer. THe tricky thing here is with inheritance -- we have a `run` and an `update` but we don't call it as it subclasses `Action`. We will be cleaning this up shortly (insomuch as we can) and thinking through the abstraction soon. This is a solution for #11
This makes the function first-class, and runsa s ingle-step function/reducer. THe tricky thing here is with inheritance -- we have a `run` and an `update` but we don't call it as it subclasses `Action`. We will be cleaning this up shortly (insomuch as we can) and thinking through the abstraction soon. This is a solution for #11
This makes the function first-class, and runsa s ingle-step function/reducer. THe tricky thing here is with inheritance -- we have a `run` and an `update` but we don't call it as it subclasses `Action`. We will be cleaning this up shortly (insomuch as we can) and thinking through the abstraction soon. This is a solution for #11
This makes the function first-class, and runsa s ingle-step function/reducer. THe tricky thing here is with inheritance -- we have a `run` and an `update` but we don't call it as it subclasses `Action`. We will be cleaning this up shortly (insomuch as we can) and thinking through the abstraction soon. This is a solution for #11
This is fixed -- see discussion/commits in 770c27f for design. |
This works when
image_location_history
is added toreads=
The append wipes the values in
image_location_history
ifimage_location_history
is not inreads=
. I.e. this doesn't not do as one expects:The text was updated successfully, but these errors were encountered: