We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
~
Condition
Should be as simple as flipping an inversion flag and changing hte name to have a ~
inversion
@action(reads=["n"], writes=["n", "n_history"]) def even(state: State) -> Tuple[dict, State]: result = {"n": state["n"] // 2} return result, state.update(**result).append(n_history=result["n"]) @action(reads=["n"], writes=["n", "n_history"]) def odd(state: State) -> Tuple[dict, State]: result = {"n": 3 * state["n"] + 1} return result, state.update(**result).append(n_history=result["n"]) is_zero = expr("n == 0") is_even = expr("n % 2 == 0") application = ( ApplicationBuilder() .with_state(n_history=[]) .with_actions( original=Input("n"), even=even, odd=odd, result=Result("n_history"), ).with_transitions( (["original", "even", "odd"], "result", is_zero), (["original", "even", "odd"], "even", is_even), (["original", "even", "odd"], "odd", ~is_even), ).with_entrypoint("original") .build() ) state, [result] = application.run(until=["result"]) ```
The text was updated successfully, but these errors were encountered:
Adds syntactic sugar for inverting conditions
277046b
Ok, this was just 15 mins of work for fun, although it does solve some slightly annoying problems. #21
59888f1
#183
Sorry, something went wrong.
No branches or pull requests
Should be as simple as flipping an
inversion
flag and changing hte name to have a~
The text was updated successfully, but these errors were encountered: