[REBOL] Enhancment Request/Suggestion Re:
From: rebol:techscribe at: 19-Sep-2000 16:37
>From the intro:
A few functions for formatting.
FORMAT aims to be a Reboloid replacement for sprintf.
It converts data into strings, with rounding of decimal
values, choice of scientific or fixed-point notation,
padding to a given length, and right and left justification.
FORMAT also handles blocks of data, with corresponding blocks
of formatting options to be applied to successive items.
QT is useful for printing out long blocks of words or numerical
data, and QC formats and prints out tabular data stored in
FULL-FORM returns a string representation of a decimal that will
load back to exactly the original value. All values that correspond
to an exact integer up to 2 ** 53 are represented as an integer.
At 05:25 PM 9/19/00 -0500, you wrote:
>Within the recent benchmark discussion, Gabriele made a comment
>which reminded me of a suggestion I have been meaning to make
>for some time.
>Almost every real application I write has a need for at least a
>rudimentary level of output formatting. Examples include:
>- truncating strings and/or padding strings with trailing blanks
> to a fixed length,
>- converting numerical values to string values, padding with
> leading blanks to a fixed length,
>- formatting decimal values as strings, complete with the usual
> sorts of leading-blank, trailing-zero, fractional-rounding
> string thrashing,
>- combining all of the above with interpolation into literal
> string data to form an entire message or output line.
>I understand/assume that the underlying REBOL infrastructure is
>written in C.
>Please consider exposing an interface to printf-style formatting
>of data values into text. Let me quickly say that I don't view
>printf as anything NEAR the acme of readability or elegance, but
>it has a few offsetting benefits to compensate for its offputting
>1) It's already in C, which I assume means it could be exposed
> in REBOL more quickly than a completely new formatting scheme
> could be conceived, designed, and developed. I certainly
> understand that RT has MANY priorities and demands on your
> time and personnel; I view this need as basic enough to
> justify considering a bit of a quick-and-dirty solution (and
> printf ain't hospital sanitary...)
>2) It could serve as the underlying mechanism supporting nicer
> interfaces that could be build above as mezzanine functions.
>3) A large portion of professional programmers have been exposed
> (in the epidemiological sense ;-) to C, and therefore would
> require almost no training or documentation to be able to
> use printf-style format strings.
>4) It could provide a "standard" means of bridging the need until
> RT has the time to build a more elegant, REBOL-style solution.
> (Here I use "standard" in the sense of "available to everyone
> using REBOL", without the need to write one's own or go find
> some code written by someone else.)
;- Elan [ : - ) ]
author of REBOL: THE OFFICIAL GUIDE
REBOL Press: The Official Source for REBOL Books
visit me at http://www.TechScribe.com