Git Product home page Git Product logo

Comments (6)

FelixPetriconi avatar FelixPetriconi commented on July 19, 2024

I see your point and we will discuss possible changes for the 1.2 release.

from libraries.

FelixPetriconi avatar FelixPetriconi commented on July 19, 2024

Sorry, that I just come now back to this.
So zip should be doing, what join is doing now? So it collects a set of n values from all upstream senders and passes it then to the process, that accepts n parameters? Or do you think, that this process should accept a tuple of n elements?
For the beginning, I would not implement a reduction/join.
So merge then will be parametrized. One option is 'round-robin', 'unordered' and 'zip' would then be the third one?

from libraries.

ivan-cukic avatar ivan-cukic commented on July 19, 2024

No need to apologize.

So, zip would strictly be:

zip(channel<T1>, channel<T2>, ...) -> channel<tuple<T1, T2, ...>>

but the option to also support n-ary processes could be cool - haven't checked how you implemented the library, but something like a constexpr-if on std::is_invocable<F, T1, T2, ...> to choose whether to use std::apply or std::invoke (separate tuple args vs pass the tuple as the argument) could do the trick.

And join would be

join(channel<channel<T>>) -> channel<T>

from libraries.

FelixPetriconi avatar FelixPetriconi commented on July 19, 2024

Currently, a channel consists of two ends: a sender and a receiver. Each receiver is associated with a process (e.g. a callable object or an instance of a process that has to implement certain functions.)

I am not that deep in functional programming - I have your upcoming book already on my order list :-) - so would a zip implementation qualify your expectations when it would go like this:

template <typename F, typename... T>
zip(F&& f, receiver<T>, ...) -> receiver<result_of_t<F(T...)>>

where F is a callable object with T... parameters?

Or must F take as argument a tuple<T...>?

from libraries.

ivan-cukic avatar ivan-cukic commented on July 19, 2024

Heh, I'm blushing :)

Usually, the zip function generates a series of tuples, and the zip_with calls an n-ary function. If you can not create one transformation that does both through static introspection, maybe zip + zip_with will do the trick (it would make it compatible with range-v3).

from libraries.

FelixPetriconi avatar FelixPetriconi commented on July 19, 2024

Fixed in 1.3.0

from libraries.

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.