[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LAMBDA: The Ultimate Formatter (was Re: Format strings are wrong)

This page is part of the web mail archives of SRFI 48 from before July 7th, 2015. The new archives for SRFI 48 contain all messages, not just those from before July 7th, 2015.



At Sun, 28 Dec 2003 02:17:10 -0500, Taylor Campbell wrote:
> 
> (define (format formatter write-char)
>    (formatter write-char))

Am I missing something?  This looks like a convoluted way of writing

  (begin
    (format-proc-1 obj1)
    (format-proc-2 obj2)
    (newline)
    ...)

I also don't see much point in putting a lot of effort in distinguishing
between formatting to strings and formatting to ports, since we have
string ports.  Write everything to output to a port.  What we are then
missing are specifically the things you left out, such as more complex
formatting of numbers, already provided as separate re-usable procedures
in all of the CL-style format implementations.

From a functional perspective you want to pass around info for things
like counting columns and possibly current "formatting rules" such as
default radix for numbers and default precision for floating point
representation, which would be a genuine improvement over the current CL
format design.  A monadic implementation may work well for this.

-- 
Alex