Skip to content
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 List.find, List.deleteFirst #29

Closed
sullyj3 opened this issue Aug 7, 2021 · 1 comment
Closed

Add List.find, List.deleteFirst #29

sullyj3 opened this issue Aug 7, 2021 · 1 comment
Labels
pull-request A pull request discussion ticket

Comments

@sullyj3
Copy link

sullyj3 commented Aug 7, 2021

Add functions for finding an item in a list by predicate, and for deleting a single item from a list by predicate. Paul asked specifically for find, I'm happy to bikeshed or remove deleteFirst if y'all prefer.


Before submitting a pull request, please doublecheck that you have included

  • a clear PR description (don't bother to include issues numbers).
  • Docs linked for types and terms as needed
  • Author and License metadata linked
  • Tests, where appropriate

Code review

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/sullyj3/myUnisonCodebase:.prs.base.listFind

Added definitions:

 List.deleteFirst                     : (a ->{g} Boolean) -> [a] ->{g} [a] (+2 metadata)
 List.deleteFirst.doc                 : Doc (+2 metadata)
 List.find.doc                        : Doc (+2 metadata)
 List.find!.doc                       : Doc (+2 metadata)
 List.deleteFirst.tests.ex1           : [Result] (+4 metadata)
 List.find.tests.ex1                  : [Result] (+3 metadata)
 List.deleteFirst.tests.ex2           : [Result] (+4 metadata)
 List.find.tests.ex2                  : [Result] (+3 metadata)
 List.deleteFirst.tests.ex3           : [Result] (+4 metadata)
 List.find                            : (a ->{g} Boolean) -> [a] ->{g} Optional a (+2 metadata)
 List.find!                           : (a ->{g} Boolean) -> [a] ->{g, Abort} a (+2 metadata)
 metadata.authors.jamessully.guid     : GUID
 metadata.authors.jamessully          : Author
 metadata.copyrightHolders.jamessully : CopyrightHolder
 metadata.licenses.jamessully         : License
@sullyj3 sullyj3 added the pull-request A pull request discussion ticket label Aug 7, 2021
@pchiusano
Copy link
Member

pchiusano commented Aug 11, 2021

Thanks! Looks good, merged in #uvabu72dbc

I merged it as is, but for the docs, I'd try to include 1-2 examples to demonstrate usage. Like check out these docs:

https://share.unison-lang.org/@bspt8cr08m0m9egkb94vlalqspkudj8363knhg7llrjoblmboa0990l5otfiljnk3md0fpi2c6462qmn7iedsjd8ckggfrk4cm5tk08/terms/base/Random/doc

And you can also see the source of the doc there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull-request A pull request discussion ticket
Projects
None yet
Development

No branches or pull requests

2 participants