Skip to content

Add the split, takeUntilIncluding, and skipUntilIncluding functions to Seq/List/FSeq/Array - #102

Merged
ntwilson merged 9 commits into
mainfrom
split
Apr 10, 2026
Merged

Add the split, takeUntilIncluding, and skipUntilIncluding functions to Seq/List/FSeq/Array#102
ntwilson merged 9 commits into
mainfrom
split

Conversation

@ntwilson

@ntwilson ntwilson commented Mar 20, 2026

Copy link
Copy Markdown
Owner

I was going for split, but the Seq implementation of split depended on takeUntilIncluding and skipUntilIncluding, which seemed useful enough to make public, so I added them to Seq (and then added them to all the other modules too)

@ntwilson ntwilson changed the title Add the split, takeWhileIncluding, and skipUntilIncluding functions to all the other modules Add the split, takeWhileIncluding, and skipUntilIncluding functions to Seq/List/FSeq/Array Mar 20, 2026
@ntwilson
ntwilson marked this pull request as ready for review March 20, 2026 18:27
@ntwilson
ntwilson requested a review from Copilot March 20, 2026 18:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends SafetyFirst’s collection helpers by adding split, takeWhileIncluding, and skipUntilIncluding across Seq, List, Array, and FSeq/FiniteSeq, along with accompanying tests and release note updates.

Changes:

  • Add takeWhileIncluding and skipUntilIncluding to Seq, List, Array, and FiniteSeq/FSeq (plus NonEmpty wrappers where applicable).
  • Add split implementations for Seq (lazy inner/outer) and for strict collections (List/Array/FiniteSeq).
  • Add/expand specs for the new functions and update ReleaseNotes.md.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
SafetyFirst/Seq.fs Adds skipUntilIncluding, takeWhileIncluding, split, and updates Seq.NonEmpty.split to delegate to the new Seq.split.
SafetyFirst/List.fs Adds skipUntilIncluding, takeWhileIncluding, split, plus List.NonEmpty.takeWhileIncluding.
SafetyFirst/FiniteSeqModule.fs Adds FiniteSeq/FSeq implementations for skipUntilIncluding, takeWhileIncluding, and split, plus NonEmpty wrappers.
SafetyFirst/Array.fs Adds skipUntilIncluding, takeWhileIncluding, split, and updates Array.NonEmpty.split to delegate to the new Array.split.
SafetyFirst.Specs/SeqSpec.fs Adds test coverage for Seq.takeWhileIncluding, Seq.skipUntilIncluding, and Seq.split.
SafetyFirst.Specs/ListSpec.fs Adds tests for List.split, plus coverage for List.(NonEmpty.)takeWhileIncluding and List.skipUntilIncluding.
SafetyFirst.Specs/FSeqSpec.fs Adds tests for FSeq.split, FSeq.takeWhileIncluding, and FSeq.skipUntilIncluding; simplifies a helper to use NonEmpty.assume.
SafetyFirst.Specs/ArraySpec.fs Adds tests for Array.split, Array.takeWhileIncluding, and Array.skipUntilIncluding (plus NonEmpty coverage).
ReleaseNotes.md Updates release notes to list the newly added functions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread SafetyFirst.Specs/SeqSpec.fs Outdated
Comment thread SafetyFirst/Seq.fs Outdated
Comment thread SafetyFirst/List.fs Outdated
Comment thread SafetyFirst/FiniteSeqModule.fs Outdated
Comment thread SafetyFirst/FiniteSeqModule.fs Outdated
Comment thread SafetyFirst/Array.fs Outdated
@ntwilson
ntwilson requested a review from Copilot March 20, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

SafetyFirst/FiniteSeqModule.fs:2439

  • Doc example code is missing a space between the first argument and the list argument (FSeq.NonEmpty.create 1[ ... ]), which makes the snippet invalid F#. Update to FSeq.NonEmpty.create 1 [ ... ].
    /// split ((=) 100) (FSeq.NonEmpty.create 1[2;3;100;100;4;100;5;6])
    ///   //returns ([[1;2;3;100];[100];[4;100];[5;6]])

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread SafetyFirst/Seq.fs
Comment thread SafetyFirst/Seq.fs
Comment thread SafetyFirst/FiniteSeqModule.fs
Comment thread SafetyFirst/FiniteSeqModule.fs Outdated
Comment thread SafetyFirst/InfiniteSeq.fs Outdated
ntwilson and others added 2 commits March 20, 2026 16:31
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ntwilson ntwilson changed the title Add the split, takeWhileIncluding, and skipUntilIncluding functions to Seq/List/FSeq/Array Add the split, takeUntilIncluding, and skipUntilIncluding functions to Seq/List/FSeq/Array Mar 20, 2026
@ntwilson
ntwilson merged commit 619487e into main Apr 10, 2026
1 check passed
@ntwilson
ntwilson deleted the split branch April 10, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants