RFC: add Scan iterator combinator
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
Proposal
This RFC proposes to add IterM.scan IterM.scanM and IterM.scanWithPostcondition (and the corresponding Iter versions).
Over in Batteries, we have been working on adding this combinator to all relevant collections. List.scanl etc. have recently been upstreamed into the stdlib. I already have a pull-request in Batteries (leanprover-community/batteries#1590) adding these combinators for iterators, however after correspondence with @datokrat and @fgdorais it seems as though stdlib is a better place.
Community Feedback
Original Zulip thread (the aforementioned correspondence about upstreaming the iterator versions were regrettably in DMs)
Summary: there is interest in adding scan* combinators to the relevant containers (List, Array, Iterator, Vector). I subsequently made 4 corresponding PRs into batteries. The first two have been merged, and List was subsequently upstreamed. Iterator and Vector are still pending.
Impact
Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to 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
Start by reviewing the existing iterator APIs in IterM and Iter, then compare the corresponding scan combinators in Batteries PR #1590 and the already-upstreamed List versions. Determine the expected behavior for scan, scanM, and scanWithPostcondition across both iterator types, with completion meaning the relevant combinators are integrated consistently with the standard library.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100