Giter Club home page Giter Club logo

Comments (4)

jbrisbin avatar jbrisbin commented on May 18, 2024

I'll try and take a look at this later today. Doing some remodeling at the house this weekend. :)

Sent from my iPhone

On May 18, 2013, at 9:34 AM, Roman Stepanenko [email protected] wrote:

The test creates this Composable (System.out.println are mine):

private Composable<Integer> createComposable(Dispatcher dispatcher) {
    return new Composable<Integer>(dispatcher)
            .map(new Function<Integer, Integer>() {
                @Override
                public Integer apply(Integer integer) {
                    System.out.println("mapping: "+integer);
                    return integer;
                }
            })
            .reduce(new Function<Composable.Reduce<Integer, Integer>, Integer>() {
                @Override
                public Integer apply(Composable.Reduce<Integer, Integer> r) {
                    int last = (null != r.getLastValue() ? r.getLastValue() : 1);
                    System.out.println("reducing: last value: "+r.getLastValue()+", nextValue: "+r.getNextValue());
                    return last + r.getNextValue();
                }
            })
            .consume(new Consumer<Integer>() {
                @Override
                public void accept(Integer integer) {
                    System.out.println("consuming: "+integer);
                    latch.countDown();
                }
            });
}

When I run the test, only consume method prints to console. Map and Reduce do not do anything.

Not sure what the test it trying to test - just speed of consuming (then kill map and reduce) or cumulative processing as well (then there is a bug somewhere because map and reduce don't produce any output)


Reply to this email directly or view it on GitHub.

from reactor.

smaldini avatar smaldini commented on May 18, 2024

I guess you also have seen the others composable tests if you're interested by quick logic examples:

from reactor.

jbrisbin avatar jbrisbin commented on May 18, 2024

There should be access to an initial Composable that will accept the first value. So the first reference should be Composable<Integer> cInt = new Composable<>(dispatcher). Then call map etc.. from that cInt. When the logic is ready to be run, call cInt.accept(intValue) which starts the whole processing chain.

from reactor.

rstepanenko avatar rstepanenko commented on May 18, 2024

Got it, working now, thank you for quick turnaround. Please fix the test later when you get a chance

from reactor.

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.