Re: syntax for inferred upper bound
Peter McGoron 15 Apr 2026 16:31 UTC
> Presumably an exception
is raised [...] if an inferred upper
bound cannot be determined (e.g. if the contents are mishaped
in that dimension.)
That is the behavior of Octave:
>> [1,2,3; 4,5,6]
ans =
1 2 3
4 5 6
>> [1,2; 3,4,5,6]
error: vertical dimensions mismatch (1x2 vs 1x4)
> Is there any situation in which you know enough to write a valid
contents datum but not enough to write all of the array's upper
bounds?
1. The array syntax could be used as an alternative to a CSV file. In
that case, a data file could contain:
#a f32 ((0 ?) (0 3))
((1 2 3)
(0.0 1.1 2.3)
(5.5 4.3 2.1)
...)
I could then add and remove values from the outermost dimension without
having to bump the upper bound.
2. If I want to input a short matrix with a nonzero lower bound, it is
easier if I don't have to do the mental math to figure out the lower
bound, i.e. when entering things at a REPL.
-- Peter McGoron