dbrattli / aioreactive

Async/await reactive tools for Python 3.11+
MIT License
350 stars 24 forks source link

Scan operator #30

Closed francipvb closed 2 years ago

francipvb commented 2 years ago

Hello,

Here is the scan operator implementation.

I've included the sync and async variants.

The reduce depends on the code on this PR.

Some tests are missing too.

Please review this and post your thoughts.

francipvb commented 2 years ago

Forgot to reference the issue #29.

dbrattli commented 2 years ago

PS: looks good. I'm making another PR to update black and pyright that should fix build issues.

francipvb commented 2 years ago

I suggest you to use pre-commit-ci and dependabot for these.

dbrattli commented 2 years ago

Thanks for the suggestion. Looks like both expression and pyright has fallen a bit behind. Please give me a few days to fix since I'm traveling this week.

dbrattli commented 2 years ago

Please try to merge master and build again. Note that you may also want to use curry_flipped from Expression to avoid the nested function. See example other places in the code. I will probably rewrite all other operators to use curry_flipped going forwards.

francipvb commented 2 years ago

Hello @dbrattli

Sorry, I had too much work and didn't see your comment.

Here is the merge commit.

francipvb commented 2 years ago

Hello @dbrattli,

The pre-commit pyright hook fails under python 3.10.

Cheers,

dbrattli commented 2 years ago

Very nice. Looks good!