Skip to content

separated_fold*1 is a reduce operation, not a fold #761

@epage

Description

@epage

separated_foldl1 and separated_foldr1 accept impl FnMut(O, S, O) -> O and return a Result<O>

Iterator::fold accepts (R, impl FnMut(R, O) -> R) and returns an R.

Iterator::reduce accepts FnMut(O, O) -> O and returns an Option<O>.

The parameters better match what Iterator::reduce accept and switching fold for reduce would better align on terminology, making it easier for users to pick up winnow through consistency.

The downside is that the trailing letter looks more odd in this situation. That convention was picked up from chumskey and we may want to consider an alternative

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-combinatorArea: combinatorsC-bugCategory: Things not working as expectedM-breaking-changeMeta: Implementing or merging this will introduce a breaking change.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions