boostorg / boostorg/hana

Properties of folds

Open
#267 0 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
1.9k
Forks
225
PR merge metrics
No merged PRs in 30d

Description

This is an old note I left myself. I was wondering whether we should require that `xs == ys` implies `fold_left(xs, state, f) == fold_left(ys, state, f)`. From a mathematical perspective, this would be the same as requesting that `fold_left` is a mathematical function, which makes sense. But for sets, which are currently foldable, this wouldn't be satisfied unless `f` satisfies some strong condition (namely that we can fold with it in any order and it's going to give the same result).

This applies equally to `fold_left` and `fold_right`.

Contributor guide

Open the contributing guide

Research direction

Start by examining the fold_left and fold_right entry points and how sets are treated as foldable. Determine whether the proposed equality property should be required, including the ordering implications for the folding function, and define the expected behavior before making any change.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.