Clarify `Expr.forEachWhere`
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
As noted in #2491, the function docstring does not sufficiently explain its difference to forEach and in what circumstances one should use it. The module docstring gives more details, but is still misleading: it does not even mention the, I believe, main property of the function, f being applied at most once to each (structurally equal) subexpression. Thus a much more relevant question as to whether the function should be used might be whether f is much more expensive than p plus expr hashing.
Thus I propose to first confirm and document the intent of the function as well as consider renaming it (such as to forEachOnceWhere) before considering any refactors on top of it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the Expr.forEachWhere function and its surrounding module and function docstrings. Read the references in #2491 and verify the intended distinction from forEach, especially the at-most-once behavior for structurally equal subexpressions. Done means the intent and usage guidance are accurate, with any rename decision recorded.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100