Branch: refs/heads/main
Revision: e2bbe90ac68e9b53f9d1791f03a518950ca4ec29
Author: lydia-duncan
Link: Provide a way for sets to zipper with more things by lydia-duncan · Pull Request #26595 · chapel-lang/chapel · GitHub
Log Message:
Provide a way for sets to zipper with more things (#26595)
[reviewed by @benharsh, with help from @bradcray]
Prior to this work, sets could only zipper with identical other sets (or
basically just itself). Zippering with sets of the same length, or with
arrays, would result in errors about unequal zippering lengths.
Resolves #15824
Adds a leader/follower pair of iterators to ChapelHashtable to support
this effort. These iterators and their support functions allow the
hashtable to evenly divide the elements stored in it, instead of evenly
dividing the entire hashtable's storage capacity.
While here, I fixed a comment that was missing a closing parenthesis.
New tests:
- Added a version of setZipDifferentSize.chpl that reversed the order,
to show that it still worked - Added a test of zippering with an array leader that is the same
length as the set - Added a test of zippering with an array follower that is the
same length as the set - Added a test of zippering with an array leader that is shorter than
the set - Added a test of zippering with an array follower that is
shorter than the set - Added a test of zippering two sets with different contents (basically,
David Longnecker's original test from #15824) - Added a test of zippering an array with the set's
toArray
result
(user code, but not expected to have changed as a result of this effort)
Places for improvement:
- It currently iterates over the whole backing hashtable for each
follower. Ideally we'd iterate over it once and store the location of
all filled elements somewhere helpful, but that's a problem for another
time
Passed a full paratest with futures
Diff:
M modules/internal/ChapelHashtable.chpl
M modules/standard/Set.chpl
M test/library/standard/Set/these/setZipDifferentSize.chpl
M test/library/standard/Set/these/setZipDifferentSize.good
A test/library/standard/Set/these/setZipDifferentSize2.chpl
A test/library/standard/Set/these/setZipDifferentSize2.good
A test/library/standard/Set/these/setZipDifferentSize2.skipif
A test/library/standard/Set/zippering/arrayShorter.chpl
A test/library/standard/Set/zippering/arrayShorter.good
A test/library/standard/Set/zippering/arrayShorter2.chpl
A test/library/standard/Set/zippering/arrayShorter2.good
A test/library/standard/Set/zippering/sameLength.chpl
A test/library/standard/Set/zippering/sameLength.good
A test/library/standard/Set/zippering/sameLength.prediff
A test/library/standard/Set/zippering/toArray.chpl
A test/library/standard/Set/zippering/toArray.good
A test/library/standard/Set/zippering/withArray1.chpl
A test/library/standard/Set/zippering/withArray1.good
A test/library/standard/Set/zippering/withArray2.chpl
A test/library/standard/Set/zippering/withArray2.good
A test/library/standard/Set/zippering/withArrayLonger1.chpl
A test/library/standard/Set/zippering/withArrayLonger1.good
A test/library/standard/Set/zippering/withRange1.chpl
A test/library/standard/Set/zippering/withRange1.good
A test/library/standard/Set/zippering/withRange1.prediff
A test/library/standard/Set/zippering/withRange2.chpl
A test/library/standard/Set/zippering/withRange2.good
A test/library/standard/Set/zippering/withRange2.prediff
https://github.com/chapel-lang/chapel/pull/26595.diff