Giter Site home page Giter Site logo

Comments (4)

mattpodwysocki avatar mattpodwysocki commented on July 1, 2024

andresier wrote Jan 27 at 7:45 AM

Have you considered using a Tuple type structure to achieve this yourself?
e.g. Tuple<T, T>
Your scan function could promote the previous update into the first item, and your current item into the 2nd.
If you want to hold more, simply change the Scan to use Tuple<T, T, T....> and create a new Tuple each scan but with the items shifted along.

Just an idea, in case you had not considered it - because it is relatively simple to achieve this yourself.

from reactive.

mattpodwysocki avatar mattpodwysocki commented on July 1, 2024

sirinath wrote Jan 27 at 8:10 AM

I raised this with the exception that this change would be replicated in other ports where there no tuple type. E.g. RxJava.

The tuple solution would be confined to the .net and a few other ports.

from reactive.

mattpodwysocki avatar mattpodwysocki commented on July 1, 2024

andresier wrote Jan 27 at 10:35 AM

Tuple was an example (one I have used for something similar), but you could create your own alternative or simply use an array. It doesn't sound right to change the method signature of Scan to handle this.
Here is an example with array. It is written in C#, but I'm sure you can port it to Java.

Something like this (untested - just hand cranked it now):

source...
.Scan(new int[3], (a, b) => {
    return new int[] { a[1], a[2], b };
})

Should produce an array each time, whereby you have the most recent 3 values.

from reactive.

mattpodwysocki avatar mattpodwysocki commented on July 1, 2024

sirinath wrote Jan 27 at 11:36 AM

This is fine. If you give a option to get n input and m output values the implementation may be more efficient.

The above will create a object each time it is evoked. Also if you want both input and output this becomes awkward as you need to keep a input data structure and output data structure.

from reactive.

Related Issues (20)

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.