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

Review of Functional Programming section #148

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

nicolaspayette
Copy link
Collaborator

There is one actual bug fix (8705604) but most of the changes I propose are minor/cosmetic.

In general, I think it's a well-written section, which conveys the advantages of FP clearly and succinctly.

I'm not sure how much we actually want to expand the section. If we do, one idea would be to add an example demonstrating how FP makes it easy to parallelize computations. I'm not sure how to do this in either C++ or Python, but I'd be happy to look into it if we think that's worth it.

(ref. #134)

By starting the reduction with a (0, 0) tuple, the function returned
an incorrect minimum of zero if all inputs were positive or an incorrect
maximum of zero if all inputs were negative.

The new version assumes that the `data` vector is not empty, which is
always the case here but might not be in real life. I think that's fine
for an example.

I also swapped `std::reduce` for `std::accumulate` to be more
consistent with the rest of the text. It's sequential by default,
and we're still providing an initial element, so I think it's
strictly equivalent in this case, but I haven't tested it.
Again, for consistency with the rest of the text.

I also believe it's strictly equivalent here, but it might be worth
double-checking.
including adding hyphens to "higher-order functions"
Feel free to overrule me on this, but it felt very ad hoc to me and was
not present in the C++ version.
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

Successfully merging this pull request may close these issues.

1 participant