0no-co / wonka

🎩 A tiny but capable push & pull stream library for TypeScript and Flow
MIT License
709 stars 29 forks source link

Sample Example output not what is expected #103

Closed idkjs closed 3 years ago

idkjs commented 3 years ago
let _= Wonka.interval(10)
  |> Wonka.sample(Wonka.interval(100))
  |> Wonka.take(2)
  |> Wonka.subscribe((. x) => print_int(x));
> node src/Sample.bs.js
## sample

`sample` emits the previously emitted value from an outer source every time
an inner source (notifier) emits.

In combination with `interval` it can be used to get values from a noisy source
more regularly.

/* Prints 10 20 to the console. */
715⏎  

Also, are there any tests for the reasonml code?

kitten commented 3 years ago

I'm not sure what the question here is, but not all examples are 100% accurate, but the code does what's described

Also, are there any tests for the reasonml code?

The reason/rescript is the JS code is the reason code, so to speak. It's a lot more ergonomic to write Jest tests (or any tests from the frameworks I've seen) in JS, and that doesn't affect or change the validity of the tests and what they assert about the Reason code.

idkjs commented 3 years ago

Sorry. The example expects an output of 10 20 but produces 7 15. Since your code is probably right, the note should read /* Prints 7 15 to the console. */

Was just an FYI, sir.

kitten commented 3 years ago

I'll have to go through all the examples after I'm back at work and will update them ✌️

idkjs commented 3 years ago

Alread did here if that helps -> https://github.com/idkjs/wonka-docs

PromiseSource doesnt work MakeSubject doesnt work