Skip to content

✨ Add for_each_butlast and initial_medial_final#215

Merged
lukevalenty merged 1 commit intointel:mainfrom
elbeno:butlast
Apr 14, 2025
Merged

✨ Add for_each_butlast and initial_medial_final#215
lukevalenty merged 1 commit intointel:mainfrom
elbeno:butlast

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
@elbeno elbeno deleted the butlast branch October 16, 2025 20:08
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