2008/2/21, Reinhold Kainhofer <[EMAIL PROTECTED]>:

> Don't ask me how it is done, but at least that's how it works in lilypond:
>
>  lilypond -e '(display (string->list (format "abc~sdef" "ffff")))'

be careful with format; there are 2 routines: simple-format (the
default, implemented in C; format is aliased to it), which requires
the port argument, and the one from the (ice-9 format) module, which
has all sorts of bells and whistles.  It is slow and generates
ridiculous amounts of garbage memory.

There is also a ly:format routine, written in C++ which is slightly
more featureful for use int the backend.  It has support for
specifying precision in floating point numbers.

lily.scm defines:


(define-public fancy-format format)
(define-public (ergonomic-simple-format dest . rest)
  "Like ice-9 format, but without the memory consumption."

  (if (string? dest)
      (apply simple-format (cons #f (cons dest rest)))
      (apply simple-format (cons dest rest))))

(define format ergonomic-simple-format)

-- 
Han-Wen Nienhuys - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen


_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to