Skip to content
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

Add fork function #70

Open
shine1594 opened this issue Dec 14, 2021 · 5 comments Β· May be fixed by #244
Open

Add fork function #70

shine1594 opened this issue Dec 14, 2021 · 5 comments Β· May be fixed by #244
Labels
enhancement New feature or request

Comments

@shine1594
Copy link
Collaborator

Suggestion

⭐ Suggestion

πŸ’» Use Cases

@shine1594 shine1594 added enhancement New feature or request v0.4 labels Dec 14, 2021
@shine1594 shine1594 mentioned this issue Dec 14, 2021
25 tasks
@darky
Copy link
Contributor

darky commented Jan 15, 2024

This issue closed without implementing
Would be nice to have multicast of Iterable/AsyncIterable via fork fn for independent parallel consuming
Like RxJS share, that multicast Observable

@ppeeou ppeeou reopened this Jan 15, 2024
@ppeeou
Copy link
Member

ppeeou commented Jan 15, 2024

Thank you for your interest :)

We've only dealt with unicast so far.
Looking at rxjs, it seems like multicast could also be useful.

Is there an expression you're thinking of?

ex)

const add1 = pipe(
  [1,2,3,4],
  map(a => a+1),
)

const forkedAdd1 = fork(add1);
const forkedAdd2 = fork(add1);

forkedAdd1.next(); // 2
forkedAdd1.next(); // 3
forkedAdd2.next(); // 2
forkedAdd3.next(); // 3

@darky
Copy link
Contributor

darky commented Jan 15, 2024

Yep, for allowance of stream multicasting to independent substreams

(if image πŸ‘‡ is dark, feel to open it on new tab)

svg-2

@darky
Copy link
Contributor

darky commented Jan 15, 2024

Inspiration: https://github.com/iter-tools/iter-tools/blob/d7.5/API.md#fork

@ppeeou
Copy link
Member

ppeeou commented Jan 16, 2024

@darky

Inspiration: https://github.com/iter-tools/iter-tools/blob/d7.5/API.md#fork

Thank you for the good reference!
I'm busy with work right now, so it might take some time before I add itπŸ™

Let me know if you're interested in contributing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants