Skip to content

Add Pair and Triple classes with zip functions#7

Merged
injoonH merged 4 commits into
mainfrom
feat/pair-triple
Aug 2, 2025
Merged

Add Pair and Triple classes with zip functions#7
injoonH merged 4 commits into
mainfrom
feat/pair-triple

Conversation

@injoonH

@injoonH injoonH commented Aug 2, 2025

Copy link
Copy Markdown
Owner

Features

  • Add Pair and Triple classes.
  • Add zip() and zipWithNext() functions.

@injoonH injoonH requested a review from Copilot August 2, 2025 02:01
@injoonH injoonH self-assigned this Aug 2, 2025
@injoonH injoonH added the enhancement New feature or request label Aug 2, 2025

This comment was marked as outdated.

@injoonH injoonH requested a review from Copilot August 2, 2025 13:02

Copilot AI left a comment

Copy link
Copy Markdown

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 tuple classes (Pair and Triple) and zip functionality to the stdlib. These classes represent generic containers for two or three values respectively, following value semantics. The implementation includes comprehensive test coverage and documentation.

  • Implements Pair<A, B> and Triple<A, B, C> classes with toList() and toString() methods
  • Adds zip() function to combine two arrays into pairs with optional transform function
  • Adds zipWithNext() function to create pairs of adjacent elements with optional transform function

Reviewed Changes

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

Show a summary per file
File Description
src/stdlib/common/tuples/Pair.ts Implements generic Pair class with constructor, toList(), and toString() methods
src/stdlib/common/tuples/Triple.ts Implements generic Triple class with constructor, toList(), and toString() methods
src/stdlib/collections/zip.ts Implements zip function with overloads for default and transform behavior
src/stdlib/collections/zipWithNext.ts Implements zipWithNext function with overloads for adjacent element pairing
src/stdlib/common/repeat.ts Utility function for repeating an action n times
src/stdlib/common/index.ts Exports Pair and Triple classes
src/stdlib/collections/index.ts Exports zip and zipWithNext functions
docs/*.md Documentation for the new classes and functions
docs/.vitepress/config.mts Updates navigation to include new API documentation
Comments suppressed due to low confidence (1)

src/stdlib/common/repeat.ts:8

  • The repeat function is not mentioned in the PR description and appears unrelated to the Pair/Triple/zip functionality. This new function lacks context for why it was added and may need its own dedicated tests or removal if it's not intended for this PR.
export function repeat(times: number, action: (index: number) => void) {

@injoonH injoonH merged commit 9032c7e into main Aug 2, 2025
@injoonH injoonH deleted the feat/pair-triple branch August 2, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants