Coder Social home page Coder Social logo

sample's People

Contributors

briancavalier avatar davidchase avatar tylors avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

rjmcguire

sample's Issues

sampler standalone working differently from standard sampler?

I ran into some troubles when using the standalone sample package. Basically both sample versions have slightly different semantics when it comes to order of subscription. For the standalone sampler, the sampler is subscribed to first, then the source.

run (sink, scheduler) {
    const sampleSink = new SampleSink(this.f, this.source, sink)
    const samplerDisposable = this.sampler.run(sampleSink, scheduler)
    const sourceDisposable = this.source.run(sampleSink.hold, scheduler)

    return new SampleDisposable(samplerDisposable, sourceDisposable)
}

while in the other sample it seems that the source is connected to first :

Sampler.prototype.run = function (sink, scheduler) {
  var l = this.sources.length
  var disposables = new Array(l + 1)
  var sinks = new Array(l)

  var sampleSink = new SampleSink(this.f, sinks, sink)

  for (var hold, i = 0; i < l; ++i) {
    hold = sinks[i] = new Hold(sampleSink)
    disposables[i] = this.sources[i].run(hold, scheduler)
  }

  disposables[i] = this.sampler.run(sampleSink, scheduler)

  return dispose.all(disposables)
}

That lead to unexpected behavior on a higher combinator that I am working on. I was able to work around this in two ways, either by directly modifying the standalone sample code to reestablish the desired order, or by forcing the source to connect first, by using drain. Both solutions are sub-optimal however (drain probably means I duplicate flows?, and direct modification of the source code means that a fresh npm install wont get the right version).

What do you recommend :

  • forking the standalone operator and npm it under another name?
  • harmonize the two sample operators?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.