-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add only
function
#33129
Add only
function
#33129
Conversation
The function `only(x)` returns the one-and-only element of a collection `x`, or else throws an error.
89c1f98
to
9235f44
Compare
failed tests on Windows look unrelated Edit: yep, now windows passes and Mac has an unrelated failure :) |
Co-Authored-By: Lyndon White <oxinabox@ucc.asn.au>
60f29f1
to
75d8cd7
Compare
Thanks, @nickrobinson251! |
I'm late to the bikeshed here, but what about renaming to |
The idea of a
(For example, i could imagine a In general, the last round of naming discussion (in #25078) I thnk came back round to |
Since this returns an element of a collection, not an iterator, I could move it to a different file, if that's preferable? I followed the previous PR in putting it in Let me know :) (Edit: I think being with |
I much prefer the name I also like the idea of holding |
Yes, I think this is a convincing argument that |
To me the only reasonable candidates are |
I think what you have is fine and it is |
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.
Overall this looks very neat to me. Given the precedent for naming and the other arguments offered for only
I think we should just go with it.
The freebsd build error is unrelated (a system problem on the build slave?).
I sort of feel the code makes more sense in But I didn't really know where to move the tests to... Except scattering them across files. So I've left it for now. In looking at tests for |
Did this PR get discussed in the triage call this week? Please let me know if anything needs doing here in order for it to get merged. Thanks for the reviews so far :) |
Triage approves; merge when tests pass. |
Tests had a silly typo, sorry. Now it looks like they didn't all run on latest commit? I only see make: *** No rule to make target 'win-extras'. Stop.
program finished with exit code 2 Is someone able to re-trigger tests? |
I've retriggered those two tests for freebsd and win64 (though hard to see how the failures could be at all related). |
I merged this - the single win64 CI error was a spurious problem in the FileWatching tests. It seems I don't understand how github's squash-and-merge functionality decides on the author, so Nick is listed redundantly in the Co-Authored-By (sorry!) |
only
function #25078