Skip to content

Stdlib: Add OneOrBoth and zipLongest on lists and streams #1003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

marzipankaiser
Copy link
Contributor

No description provided.

Copy link
Contributor

@jiribenes jiribenes left a comment

Choose a reason for hiding this comment

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

The code is, I think, perfectly fine, but:

🚲, I really like Unison's names for these operations :)

/// ```
///
/// O(N)
def zipLongest[A, B](left: List[A], right: List[B]): List[These[A, B]] = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Bikeshed: Unison calls this align which is a bit nicer, perhaps?
(ditto for streams)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I care more about the name. Honestly, I would not search for this under the name align and don't quite get how this describes the operation well. align is a single word, but I fail to see how this fits the semantics uniquely.

Copy link
Contributor

Choose a reason for hiding this comment

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

Funnily enough align is the name used in Haskell :D
https://hackage.haskell.org/package/semialign-1.3.1/docs/Data-Align.html#v:align

Copy link
Contributor

Choose a reason for hiding this comment

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

We could also "just" call it zip and rely on the overload resolution ;)

@marzipankaiser marzipankaiser marked this pull request as ready for review May 19, 2025 12:04
marzipankaiser and others added 2 commits May 19, 2025 15:58
@marzipankaiser marzipankaiser changed the title Stdlib: Add These and zipLongest on lists and streams Stdlib: Add OneOrBoth and zipLongest on lists and streams May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants