On Tue, Nov 20, 2018 at 5:36 AM Per Bothner <xxxxxx@bothner.com> wrote:
I can't think of a use for this. Do you have an example?

If you're printing #a(#f32(....) #f64(....)), you might want to have different format string (e.g. "~,6f" for f32 value, "~,15f" for f64 value) depending on the type of the subarray.
Or, printing #a(#u8(...) #u32(...)) and "~4d" for u8array and "~11d" for u32array.


 

On 11/20/18 7:06 AM, John Cowan wrote:
> I recommend that the format string be replaced by a procedure that accepts two arguments, the object to be printed and a port to print it to, with the default procedure being `display`.  This will make `format-array` equally useful to template systems like SRFI 48 and combinator systems like SRFI 159.

Note that sub-objects will always printed to a string port, since it would have to
write to a temporary buffer, so you can "tile" the sub-outputs together.
A procedure that returns a strings is somewhat easier to work with (and more
"functional") than one that takes a port argument.
--
        --Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/