Extract GobLint.cartesian_*map functions#1890
Merged
Conversation
9a36ac4 to
332023d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extracts three new utility functions (cartesian_map, cartesian_filter_map, and cartesian_concat_map) into GobList to unify common patterns found throughout the codebase. These patterns typically involved using BatList.cartesian_product followed by List.map, or using List.map inside List.concat_map to achieve cartesian product operations.
Key changes:
- Added three new
GobList.cartesian_*maputility functions - Refactored multiple occurrences of the cartesian product + map pattern across the codebase
- Updated function signatures from tuple-destructuring to separate parameters where appropriate
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/util/std/gobList.ml |
Added three new utility functions: cartesian_map, cartesian_filter_map, and cartesian_concat_map |
tests/unit/dune |
Added -open Goblint_std flag to make GobList functions available |
tests/unit/maindomaintest.ml |
Replaced BatList.cartesian_product + List.map with GobList.cartesian_map |
tests/unit/cdomains/intDomainTest.ml |
Removed local cart_op helper and used GobList.cartesian_map |
src/domains/intDomainProperties.ml |
Replaced cartesian product pattern with GobList.cartesian_map |
src/domain/hoareDomain.ml |
Multiple conversions to GobList.cartesian_map and cartesian_filter_map |
src/cdomains/congruenceClosure.ml |
Removed local map2 helper, converted to GobList.cartesian_map, added TODO for potential future extraction |
src/cdomain/value/cdomains/structDomain.ml |
Kept BatList.cartesian_product with TODO comments for potential future conversion |
src/cdomain/value/cdomains/int/intervalSetDomain.ml |
Converted multiple functions to use all three cartesian variants, updated function signatures from tuple to separate parameters |
src/arg/myARG.ml |
Renamed cartesian_concat_paths to cartesian_append and implemented with GobList.cartesian_map |
src/analyses/extractPthread.ml |
Updated lambda signature and used GobList.cartesian_map |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is on top of #1886 because I got the idea there.GobList.cartesian_mapunifies two kinds of patterns I found in various places:List.maponBatList.cartesian_product.List.mapinsideList.concat_map.In a few places, the variants
GobList.cartesian_filter_mapandGobList.cartesian_concat_mapare introduced.