-
Notifications
You must be signed in to change notification settings - Fork 84
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
scan, scanMerge inconsistent initial behavior #161
Comments
If you want to get the same behavior from |
I don't think that's relevant to the issue. |
Here's an example where both operators are used in the same way, but produce different initial results. const x = scan
((acc, v) => acc + v)
(0)
(stream(345))
x() // 345
const y = scanMerge
([ [ stream(345), (acc, v) => acc + v ] ])
(0)
y() // 0 |
Also note that |
When using
scan
on a stream, if the stream does not yet have a value, the initial value is set on the returned stream.scanMerge
also uses the initial value as the first (and immediate) value of the returned stream. However,scan
will use the given stream's value immediately (as the initial value), if that stream does already have a value, butscanMerge
doesn't care about the state of the streams it is scanning/merging, and always uses the initial value initially. Is it intentional thatscan
andscanMerge
handle this differently or is one of them wrong?The text was updated successfully, but these errors were encountered: