-
Notifications
You must be signed in to change notification settings - Fork 10k
Use iterators for graph vertices #36558
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
Conversation
520ba28
to
2dbb6dc
Compare
2dbb6dc
to
d519339
Compare
internal/dag/seq.go
Outdated
// SelectSeq filters a sequence to include only elements that can be type-asserted to type U. | ||
// It returns a new sequence containing only the matching elements. | ||
// The yield function can return false to stop iteration early. | ||
func SelectSeq[T Vertex, U Vertex](seq VertexSeq[T], filter func(U)) VertexSeq[U] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need the filter function at all here? It's not being called, and you can specify the type using the [...]
syntax: SelectSeq[MockVertex2, MockVertex](...)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was only there so that the type can be inferred, instead of the compulsory type constraint like this syntax, but it is probably better to use the natural syntax. Also, we actually only needed a single type constraint.
One type parameter seem to be enough instead of 2
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Fixes #
Target Release
1.13.x
CHANGELOG entry