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

Improve support for custom list object implementations #2985

Merged
merged 4 commits into from
Nov 12, 2018

Conversation

ChrisJefferson
Copy link
Contributor

This is a selection of fixes which I came up with while trying to implement an object which acts as a mutable list.

  • SortParallel requires IsDenseList. Sort and SortBy only require IsList and work fine, so unify with them.

  • IsSSortedList requires the list is homogenous. In the distant past this was required for all lists, and then the requirement was removed for plists, without removing it for plists.

  • Make sure we don't call _FILT_LIST on non-plists. To be honest I'm not totally happy with this and considered rewriting this bit of code to make it less fragile, but decided I didn't want to go down that rabbithole. This certainly makes things better than they were.

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

In one of the commit messages, change tnum value,T_INT , but to tnum value, T_INT, but

src/lists.c Outdated Show resolved Hide resolved
src/listfunc.c Outdated Show resolved Hide resolved
src/listfunc.c Outdated Show resolved Hide resolved
src/listfunc.c Outdated Show resolved Hide resolved
src/listfunc.c Outdated Show resolved Hide resolved
src/lists.h Outdated Show resolved Hide resolved
src/lists.h Outdated Show resolved Hide resolved
src/lists.h Outdated Show resolved Hide resolved
src/lists.h Outdated Show resolved Hide resolved
tst/testinstall/objlist.tst Show resolved Hide resolved
@ChrisJefferson ChrisJefferson force-pushed the homogenous-list branch 3 times, most recently from 63f1720 to 590760d Compare November 9, 2018 20:55
@ChrisJefferson
Copy link
Contributor Author

Fixes made. I'm sure a more complete overhall of lots of list based stuff could be made (and reading comments in the source, many things were never finished in the first place), but this adds enough functionality for many basic cases, including the cases I want to work.

src/lists.h Show resolved Hide resolved
src/plist.c Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Nov 11, 2018

Codecov Report

Merging #2985 into master will increase coverage by 0.02%.
The diff coverage is 87.5%.

@@            Coverage Diff             @@
##           master    #2985      +/-   ##
==========================================
+ Coverage   85.21%   85.24%   +0.02%     
==========================================
  Files         110      110              
  Lines       56857    56877      +20     
==========================================
+ Hits        48450    48482      +32     
+ Misses       8407     8395      -12
Impacted Files Coverage Δ
src/plist.c 93.88% <100%> (ø) ⬆️
src/lists.c 73.51% <100%> (+1.51%) ⬆️
src/lists.h 96.55% <83.33%> (-3.45%) ⬇️
src/objset.c 84.71% <0%> (+0.22%) ⬆️
src/set.c 97.83% <0%> (+0.27%) ⬆️
src/sysmem.c 58.23% <0%> (+0.58%) ⬆️

Make the _FILT_LIST functions be a no-op when the FiltList they
use is 0, so they can be safely called on non-list types.

0 is the default value used for the FiltLists. It is also a
valid tnum value, T_INT, but it would never make sense for one
of the  *_FILT_LIST functions to turn something into a T_INT.
This has long been the case for plists, this adds support for
lists which are not plists to also be non-homogenous and strictly
sorted.
This was already allowed in Sort. While Sort and ParallelSort
both fail with an error if given a non-dense lists, there can
exists lists which are dense but do not have the filter IsDenseList
@ChrisJefferson ChrisJefferson merged commit ab6497a into gap-system:master Nov 12, 2018
@ChrisJefferson ChrisJefferson deleted the homogenous-list branch January 20, 2019 13:38
@PaulaHaehndel PaulaHaehndel added the release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes label Apr 15, 2019
@fingolfin fingolfin changed the title List object improvements Improve support for custom list implementations Aug 22, 2019
@fingolfin fingolfin changed the title Improve support for custom list implementations Improve support for custom list objects Aug 22, 2019
@fingolfin fingolfin changed the title Improve support for custom list objects Improve support for custom list object implementations Aug 22, 2019
@fingolfin fingolfin added 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 and removed release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Aug 22, 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
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.

4 participants