persistable sclass InterpolatedDoubleArray is IntSize { int[] indices; double[] values; *(int[] *indices, double[] *values) {} public int size aka length() { ret empty(indices) ? 0 : last(indices)+1; } int nPillars() { ret l(indices); } double[] toDoubleArray aka get() { int n = length(); double[] array = new[n]; for (int i = 0; i < indices.length; i++) { int iEnd = indices[i]; double value = values[i]; array[iEnd] = value; if (i > 0) { int iStart = indices[i-1]; if (iStart+1 < iEnd) { double startValue = values[i-1]; double step = (value-startValue)/(iEnd-iStart), val = startValue; for (int j = iStart+1; j < iEnd; j++) { val += step; array[j] = val; } } } } ret array; } }