FxTS icon indicating copy to clipboard operation
FxTS copied to clipboard

Add `fork` function

Open shine1594 opened this issue 4 years ago β€’ 5 comments

Suggestion

⭐ Suggestion

πŸ’» Use Cases

shine1594 avatar Dec 14 '21 05:12 shine1594

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

darky avatar Jan 15 '24 14:01 darky

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

ppeeou avatar Jan 15 '24 16:01 ppeeou

Yep, for allowance of stream multicasting to independent substreams

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

svg-2

darky avatar Jan 15 '24 17:01 darky

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

darky avatar Jan 15 '24 17:01 darky

@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

ppeeou avatar Jan 16 '24 14:01 ppeeou