Programming Challenge Numbers to Text?
Levi Pearson
levi at cold.org
Fri May 5 14:43:39 MDT 2006
On May 5, 2006, at 2:34 PM, Shane Hathaway wrote:
> Levi Pearson wrote:
>> That is essentially equivalent to the following C-ish code:
>> fprintf(stdout, "%r\n%r\n%r\n%r\n%r\n", 1, 15, 91283, 4918239,
>> 2147483947);
>
> Ok, I should have noticed that.
>
>> You sound very obtuse to me, and I would consider your comment a
>> mark against you.
>
> I don't think I sound obtuse, although I'm sure I sound dense. ;-)
>
> Still, the fact that it's a language feature rather than a library
> function looks like a mistake to me.
>
The definition of Common Lisp is almost all 'standard library' stuff,
because the language grammar itself is rather simple. Just as printf
is in the C standard library, format is in standardized Common Lisp.
BTW, you /can/ extend format to add new ~ directives, so ~r could
have been implemented as a library. I think it's great to have a
string formatting function that makes it trivial to create readable,
gramatically-correct output strings.
I still haven't figured out your reasoning for thinking this was a
mistake. On the other hand, Scheme exists for people who want to use
Lisp but want to write all the libraries themselves.
--Levi
More information about the PLUG
mailing list