Skip to content

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
Co-authored-by: Jiří Beneš <mail@jiribenes.com>
@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
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.

I'd still prefer a different name than zipLongest, but I'm fine with the contents, so feel free to merge this if you want to, @marzipankaiser

@marzipankaiser marzipankaiser merged commit 28925ce into master Jul 30, 2025
3 checks passed
@marzipankaiser marzipankaiser deleted the stdlib/zip-longest branch July 30, 2025 08:17
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.

3 participants