> Write a function that takes as its right argument a vector of simple arrays of rank 2 or less (scalar, vector, or matrix). Each simple array will consist of either non-negative integers or printable ASCII characters. The function must return a simple character array that displays identically to what {⎕←⍵}¨ displays when applied to the right argument.
There are so many approaches to this one. Some lead to very brief and simple solutions, others to… well not that.
Technically, you can write ⎕TC[2] but please don't.
We can simply stack the arrays and format that. Since the result is nested, the default display form is adding a column of spaces to the left and far right. Then we can simply strip those columns off!
OK, but btw, ⎕FMT is (for arrays without control chars) just like ⍕ but always returns a matrix. Convenient here.
So, one (crazy) approach is to format each array as a matrix, then widen them all until the width of the widest one, then stack them. Wanna try or shall I just show how?
An even crazier one is to automatically widen the matrices by just mixing them. However, this also lengthens them by adding blank rows until they have the same height. Then you need a way to identify which rows were added, so you can remove them. And no, you cannot just remove all-blank rows, as those are valid parts of input.
All it does is demote the array (lessen the rank by 1) by combining the two leading axes (essentially replacing their entries in the shape by their product).
Anyway, the critical part is 1⍨⍤1¨f where we replace each row by a scalar 1 such that ↑ will pad with 0s and the result (after ravelling) is a vector.