CenterArray¶
Center a list within a larger array.
A scalar centers a single element, padding the rest with 0:
Multi-dimensional specifications produce nested arrays:
$ wo 'CenterArray[x, {5, 5}]'
{{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, x, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}
With a single argument, the centered element defaults to 1: