guile-user
[Top][All Lists]
Advanced

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

Re: add printf.scm to ice-9?


From: Steve Tell
Subject: Re: add printf.scm to ice-9?
Date: Mon, 8 Apr 2002 22:43:22 -0400 (EDT)

On Sun, 7 Apr 2002, Per Bothner wrote:

> most of Common Lisp format within Kawa:
> 
> #|kawa:1|# (format "[~12,5e]" (sqrt 2))
> [  1.41421E+0]

In guile, that's  (format #f "[~12,5e]" (sqrt 2))

I've wondered how one would translate somthing like 
        (let ((w 12)(d 5)) (printf "%*,*e" w d (sqrt 2)))
though.


But how terrible would it really be to provide both format and printf? 

Seems to me one of the great things about guile is that it brings together
both the lisp tradition and the unix tradition.  If this means a bigger
library of available routines, so be it. A lot of posix and other libc
functions are already provided as guile primitives or library routines.  
But in the unix tradition, formatted I/O means printf, as in C, bash, awk,
perl, etc.  What's one more library module in the name of providing
familar ground for programmers from both traditions?

Yes, of course the lisp-inherited format has bunch of additional features.  
It took a few minutes of study for me to decide that format-strings
probably aren't turing complete, but I'm still not 100% convinced.  
(Loops and conditionals in a format string? the mind boggles).










reply via email to

[Prev in Thread] Current Thread [Next in Thread]