Skip to content

feat: add seq.Pairwise()#11

Merged
aereal merged 1 commit intomainfrom
sliding
Nov 17, 2025
Merged

feat: add seq.Pairwise()#11
aereal merged 1 commit intomainfrom
sliding

Conversation

@aereal
Copy link
Owner

@aereal aereal commented Nov 17, 2025

No description provided.

@aereal aereal self-assigned this Nov 17, 2025
Copilot AI review requested due to automatic review settings November 17, 2025 13:21
@github-actions
Copy link

Code Metrics Report

#9 (01754da) #11 (40a0df6) +/-
Coverage 88.0% 88.4% +0.4%
Code to Test Ratio 1:2.2 1:2.2 -0.1
Test Execution Time 9s 14s +5s
Details
  |                     | #9 (01754da) | #11 (40a0df6) |  +/-  |
  |---------------------|--------------|---------------|-------|
+ | Coverage            |        88.0% |         88.4% | +0.4% |
  |   Files             |            2 |             2 |     0 |
  |   Lines             |          100 |           113 |   +13 |
+ |   Covered           |           88 |           100 |   +12 |
- | Code to Test Ratio  |        1:2.2 |         1:2.2 |  -0.1 |
  |   Code              |          183 |           203 |   +20 |
+ |   Test              |          420 |           463 |   +43 |
- | Test Execution Time |           9s |           14s |   +5s |

Code coverage of files in pull request scope (88.5% → 88.9%)

Files Coverage +/- Status
seq/seq.go 88.9% +0.4% modified

Reported by octocov

@aereal aereal merged commit 23354e9 into main Nov 17, 2025
11 checks passed
@aereal aereal deleted the sliding branch November 17, 2025 13:23
Copy link

Copilot AI left a comment

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 adds a Pairwise() function to the seq package that generates consecutive overlapping pairs from an iterator. For example, given [a, b, c, d], it yields [(a, b), (b, c), (c, d)].

Key changes:

  • Implemented Pairwise[T any](s iter.Seq[T]) iter.Seq2[T, T] function using iter.Pull to generate consecutive pairs
  • Added comprehensive test cases covering empty sequences, single elements, and multiple-element sequences

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
seq/seq.go Implements the Pairwise() function that returns an iterator over consecutive pairs of elements using iter.Pull for efficient state management
seq/seq_test.go Adds test cases for Pairwise() covering edge cases including empty input, single element, and sequences with 3-4 elements

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

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.

1 participant