We call this feature "skyline" arrays or "jagged" arrays. While Chapel currently does not implement it directly, it is easy to do it with records. For example, each element of the outer array can be a record carrying the corresponding inner array and its domain:
record InnerArray {
var dom: domain(1); // starts out empty
var arr: [dom] int;
// Optional function: when printing an InnerArray, do not show the domain.
proc writeThis(c: channel) { c.write("["); c.write(arr); c.write("]"); }
}
proc initElem(ref dest: InnerArray, src: []) {
dest.dom = src.domain;
dest.arr = src;
}
var A: [1..3] InnerArray;
initElem(A[1], [1,2,5]);
initElem(A[2], [3,5]);
initElem(A[3], [2,6,9]);
// The default printout invokes writeThis on each element of A.
writeln(A);
// To iterate over all inner elements, need nested loops.
// If appropriate, either/both can be "forall".
for outer in A do
for inner in outer.arr do
writeln(inner);