You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Map can easily be generalized to support non-bijective mapping, at least in surjective sense (dropping some outputs).
The same can be achieved with map | filter flow, but sometimes non-emitting the output can be done more easily.
Usage example:
class IncOdd(Runnable):
def next(self, state):
if state.number % 2:
return state.updated(number=state.number + 1)
inp = States(*(State(number=i) for i in range(5)))
out = Map(IncOdd()).run(inp).result()
exp = States(State(number=1), State(number=3))
assert out == exp
The text was updated successfully, but these errors were encountered:
Map
can easily be generalized to support non-bijective mapping, at least in surjective sense (dropping some outputs).The same can be achieved with
map | filter
flow, but sometimes non-emitting the output can be done more easily.Usage example:
The text was updated successfully, but these errors were encountered: