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 First(list), Last(list) and Last(list,func) #3365

Merged
merged 2 commits into from
Mar 25, 2019

Conversation

fingolfin
Copy link
Member

Another PR I had sitting around for a couple years...

This returns the first element of the given list; i.e., it is roughly
equivalent to `First(list, ReturnTrue)`.
`Last(list)` returns the last element of the list, while `Last(list, func)`
returns the last element for which the predicate `func` returns true.
@fingolfin fingolfin added kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes topic: libgap things related to libgap labels Mar 20, 2019
@fingolfin fingolfin added the gapdays2019-spring Issues and PRs that arose at https://www.gapdays.de/gapdays2019-spring label Mar 20, 2019
Copy link
Member

@sebasguts sebasguts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@fingolfin
Copy link
Member Author

The error is due to the qaos package which defines a global Last (and then never uses it). I already removed that in the qaos repository, and thought about making a release... but unfortunately it seems we are going to have to remove qaos from the distribution anyway, see gap-packages/qaos#13

Copy link
Member

@wilfwilson wilfwilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this addition, nice! I was going to ask you to remove the whitespace before the end ); lines at the end of an InstallMethod, but I saw that this is how it is done everywhere else in the file, so no bother.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 85.185% when pulling 9454a0e on fingolfin:mh/Last into 38aa4e8 on gap-system:master.

@wilfwilson wilfwilson merged commit d0bff44 into gap-system:master Mar 25, 2019
@fingolfin fingolfin deleted the mh/Last branch March 25, 2019 20:21
@fingolfin fingolfin added release notes: added PRs introducing changes that have since been mentioned in the release notes and removed topic: libgap things related to libgap release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Apr 15, 2019
@olexandr-konovalov olexandr-konovalov added this to the GAP 4.11.0 milestone Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gapdays2019-spring Issues and PRs that arose at https://www.gapdays.de/gapdays2019-spring kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements release notes: added PRs introducing changes that have since been mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants