Skip to content

✨ Add for_each_butlast and initial_medial_final #215

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

Merged
merged 1 commit into from
Apr 14, 2025

Conversation

elbeno
Copy link
Contributor

@elbeno elbeno commented Apr 10, 2025

Problem:

  • There is no algorithm that does for_each on a range except for the last N
    elements.
  • There is a use case for a tripartite operation on a range: one operation for
    the initial element, another operation for each medial element, and a third
    operation for the final element.
  • The return values of for_each and for_each_n do not follow the law of
    Useful Return.

Solution:

  • Add for_each_butlastn, for_each_butlast, and initial_medial_final.
  • Return all useful information from for_each and for_each_n.

@elbeno elbeno force-pushed the butlast branch 2 times, most recently from 25b6cfa to 44d7996 Compare April 10, 2025 02:16
Problem:
- There is no algorithm that does `for_each` on a range except for the last N
  elements.
- There is a use case for a tripartite operation on a range: one operation for
  the initial element, another operation for each medial element, and a third
  operation for the final element.
- The return values of `for_each` and `for_each_n` do not follow the law of
  Useful Return.

Solution:
- Add `for_each_butlastn`, `for_each_butlast`, and `initial_medial_final`.
- Return all useful information from `for_each` and `for_each_n`.
Copy link
Contributor

@lukevalenty lukevalenty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like all the unit tests

@lukevalenty lukevalenty merged commit dd795ab into intel:main Apr 14, 2025
40 checks passed
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.

2 participants