<jupyter_start><jupyter_text>To run, your code must be wrapped in a coroutine (function defined with `async def`) and then fed to the event loop to execute.<jupyter_code>async def f():
    stream = await start(source, FuncSink(aprint))
    
my_run(f)
async def f():
    async with start(source) as stream:
        async for x in stream:
            print(x)
    
my_run(f)
# my own attempt to just get the next value - fails; 
# sent an email to aioreactive author <NAME> asking how to do it properly
async def f():
    async with start(source) as stream:
        while True:
            x = await stream.__anext__()
            print(x)
    
my_run(f)
async def main():
    xs = Producer.from_iterable(range(10))

    # Split into odds and evens
    odds = xs | ops.filter(lambda x: x % 2 == 1)
    evens = xs | ops.filter(lambda x: x % 2 == 0)

    async def mysink(value): # why does this need to be async?
        print(value)

    await start(odds, FuncSink(mysink))
    await start(evens, FuncSink(mysink))

my_run(main)<jupyter_output>1
3
5
7
9
0
2
4
6
8
{'fraction_non_alphanumeric': 0.09802073515551367, 'fraction_numerical': 0.015080113100848256, 'mean_word_length': 2.8339350180505414, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '24810', 'license': 'Apache-2.0', 'n_tokens_mistral': 374, 'n_tokens_neox': 365, 'n_words': 135, 'path': 'notebooks/aioreactive games.ipynb', 'repo_name': 'ZmeiGorynych/rxpy-extensions', 'size': '1066'}