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
You need a ConcatenatedSequence
that joins two sequences without allocating storage
#258
Comments
Sounds similar to |
Ah yes, thanks!
FWIW, the division of libraries into Algorithms and Collections doesn’t make a lot of sense to me. I knew I was looking for a collection, so why would I go looking at that other library?
I guess Algorithms is where you put all the collection adapters?
… On Dec 30, 2022, at 9:08 PM, Matt Zanchelli ***@***.***> wrote:
Sounds similar to chain(_:_:) in swift-algorithms <https://github.com/apple/swift-algorithms/blob/main/Guides/Chain.md>
—
Reply to this email directly, view it on GitHub <#258 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAAKYIP2EEN3AJKUCQ3KCM3WP65UJANCNFSM6AAAAAATNLHMJY>.
You are receiving this because you authored the thread.
|
A lot of the algorithms in swift-algorithms end up producing a I do wonder what the future of the relationship between the two packages is, though. There are algorithms that could benefit from using one of the collections in swift-collections, like |
FWIW, I always thought that a much more granular approach was more appropriate (hence the organization of https://github.com/loftware, which was supposed to end up being more than it is). The idea that there's just one library of Swift algorithms and one library of containers out there is not only unrealistic, but it discourages a vibrant library package ecosystem by making any collection or algorithm hosted elsewhere seem like a second-class citizen. It also contributes to Swift seeming like an Apple thing rather than an open-source thing. Swift really needs a social (if not technical) equivalent of Boost, where separate components are developed and peer-reviewed, but not subject to Apple's gatekeeping, and where new domains can be explored and approved without ceremony. |
FWIW, here is how I look at it: Swift Collections tends to provide classic general purpose mutable data structures, usually with relatively heavyweight implementations. Clients are expected to import that package to get access to the types themselves. (Something vaguely like Swift Algorithms tends to concentrate on lazy or eager implementations of generic operations on the Collection protocol hierarchy. The primary entry points are individual functions. (Something vaguely like Swift Numerics does both types and individual operations; the common theme there is numerical computing. To me, concatenating two sequences feels more like a sequence operation than a classic data structure; hence the Swift Algorithms package feels like a more appropriate home for it. |
Closing; as @mdznr noted, we already have an implementation of this operation in Swift Algorithms. |
This is not fully documented and could use conditional MutableCollection/Equatable/Hashable conformances, but it's a pretty complete implementation that you could use as a starting point.
The text was updated successfully, but these errors were encountered: