Applies a function that operates on an IndexTransform to a Spec.
This definition allows DimExpression objects to be applied to Spec
objects.
- Returns:
The transformed Spec on success.
- Error absl::StatusCode::kInvalidArgument:
if spec.transform() is not
valid.