Skip to content

Conversation

@sim642
Copy link
Member

@sim642 sim642 commented Dec 2, 2025

This is on top of #1886 because I got the idea there.

GobList.cartesian_map unifies two kinds of patterns I found in various places:

  1. List.map on BatList.cartesian_product.
  2. List.map inside List.concat_map.

In a few places, the variants GobList.cartesian_filter_map and GobList.cartesian_concat_map are introduced.

@sim642 sim642 added this to the v2.8.0 milestone Dec 2, 2025
@sim642 sim642 added cleanup Refactoring, clean-up pr-dependency Depends or builds on another PR, which should be merged before labels Dec 2, 2025
@sim642 sim642 force-pushed the list-concat_map-map branch from 9a36ac4 to 332023d Compare December 2, 2025 13:00
Base automatically changed from arg-uncil-ambiguous to master December 4, 2025 13:41
@sim642 sim642 removed the pr-dependency Depends or builds on another PR, which should be merged before label Dec 4, 2025
@sim642 sim642 marked this pull request as ready for review December 4, 2025 13:47
@sim642 sim642 requested a review from Copilot December 22, 2025 13:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_*map utility 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.

@sim642 sim642 merged commit 379b3a1 into master Dec 22, 2025
25 checks passed
@sim642 sim642 deleted the list-concat_map-map branch December 22, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Refactoring, clean-up

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants