/// If this domain is already ground, return a mutable reference to the underlying [GroundDomain].
/// If this domain is unresolved, return a mutable reference to the underlying [UnresolvedDomain].
let idx_doms: Vec<DomainPtr> = idx_doms_gds.iter().cloned().map(|d| d.into()).collect();
/// If this is a [GroundDomain::Matrix], get immutable references to its element and index domains
/// If this is a [GroundDomain::Matrix], get mutable references to its element and index domains
/// If this is a [GroundDomain::Set], get immutable references to its attributes and inner domain
/// If this is a [GroundDomain::MSet], get immutable references to its attributes and inner domain
/// If this is a [GroundDomain::MSet], get mutable references to its attributes and inner domain
/// If this is a [GroundDomain::Function], get mutable references to its (attrs, domain, co-domain)
/// If this is a [GroundDomain::Partition], get immutable references to its attributes and inner domain
/// If this is a [GroundDomain::Partition], get mutable references to its attributes and inner domain
/// As opposed to `Domain::length`, this function returns a signed integer (`i32`) rather than unsigned.
/// * `DomainOpError::TooLarge` - Converting to an integer my not be possible if the domain is too big