Sequence and collection modifiers

A few months ago, I started implementing these StarterProposals / StarterBugs:

After finishing implementing them, I added others inspired from Rust's iterator adaptors and [SR-6864] Add a "cycle" method to the standard library · Issue #49413 · apple/swift · GitHub.

Here's the package if you're interested:

It includes support for

  • lazy splitting sequences and collections
  • chunking sequences and collections
  • windowing sequences and collections
  • chaining sequences together
  • cycling sequences
  • inspecting sequences (easier debugging)
  • map while (like prefix(while:) but supports map and filter remaining lazy)
  • peeking on an iterator
  • repeating an element forever
  • scanning (similar to reduce but keeping all previous instances)
  • stepping by a fixed number of steps

I plan on adding more string modifiers sense for strings like lines.

Question:

What would the next steps be to add these modifiers to the standard library assuming that is still desired?

3 Likes

The typical flow is as follows:

  1. Pitch.
  2. Proposal and implementation.
  3. Review by community and core team. Possibly sent for revision back to step 2.
  4. Addition to the standard library preview package.
  5. Gather feedback and make changes based on usage experience.
  6. Addition to standard library.

All of this is from memory, I didn't read the docs, so I might've missed something. :sweat_smile:

I guess this could count as Pitch phase. The whole process is documented here:

1 Like