Email list hosting service & mailing list manager


should format-array take a port argument? Per Bothner 15 Nov 2018 18:07 UTC

The Kawa implementation of format-array returns a string, which of course
can be passed to display.  In Kawa the default REPL output uses display,
so you can use format-array directly in the command-line.  In a REPL
which defaults to using write (which I believe is most Schemes),
you would have to do (display (format-array ARR)) which is inconvenient.

I suggest:
    (format-array VALUE [PORT] [ELEMENT-FORMAT])
where PORT has the same interpretation as in SRFI-48.
If PORT is unspecified, the default is #f (as for SRFI-48 format).

An implementation would be allowed to implement
    (format-array VALUE PORT [ELEMENT-FORMAT]) ;; non-boolean PORT
as
   (display (format-array #f VALUE [ELEMENT-FORMAT]) PORT)
I.e. ELEMENT-FORMAT may not portably depend on the current position
or "available width".
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/