Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 3 - Compose function #112

Open
jamespavett opened this issue Jan 21, 2022 · 0 comments
Open

Chapter 3 - Compose function #112

jamespavett opened this issue Jan 21, 2022 · 0 comments

Comments

@jamespavett
Copy link

Hello, not really an issue but something I am just unsure about.

const compose = (...fns) =>
      (arg) =>
      fns.reduce(
        (composed, f) => f(composed),
        arg
    )

In chapter 3 compose is shown to use the array reduce function, along with being discussed that way in the next.

Doesn't this differ from tradition convention though. Using reduce is traditionally a pipe as it operating left-to-right. The name compose is usually used for a right-to-left pipe where reduceRight is used. Just including the following link as an example of what I mean: https://aparnajoshi.netlify.app/javascript-pipe-and-compose-functions

Obviously is this book compose is being used for reduce operations acting left-to-right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant