behaviour of ~& in format string
Stephen Lewis <[email protected]> Sat, 2 Jul 2005 16:46:29 -0700
| Newsgroups | gmane.lisp.scheme.srfi.srfi-48 |
|---|---|
| Message-ID | <[email protected]> |
Ken Dickey, I believe that '~&" should ensure that output begins on a new line. That is, output a newline character if (and only if) the output stream is *not* already at the start of a line. I have compared SRFI-48 (version posted here June 26) with Common Lisp, Guile, Gauche and STklos and find that SRFI-48 behaves differently from Common Lisp and the Guile module (ice-9 format) and STKlos default. Here is my test code: ============================================================================= ;;; ;;; Copyright (c) 2005 Stephen Lewis ;;; ;;; test behaviour of (format ...) re linefeeds ;;; ; clisp -q program.lsp ;(format t "Clisp/default~%") (define t #t) ; for Scheme ; guile -s program.lsp ;(use-modules (ice-9 format)) (format #t "Guile/ice-9~%") ;(load "./srfi-48.scm") (format #t "Guile/srfi-48~%") ; gosh program.lsp ;(load "./srfi-48.scm") (format #t "Gauche/srfi-48~%") ; stklos -f program.lsp ;(format t "STklos/default~%") ; (format t "Testing linefeeds...~%") (format t "---~%") (format t "abc~%~&def~&ghi~%") (format t "---~%") (format t "abc~%") (format t "~&def~&ghi~%") (format t "---~%") ============================================================================= and here are my results: ============================================================================= Clisp/default Testing linefeeds... --- abc def ghi --- abc def ghi --- Guile/ice-9 Testing linefeeds... --- abc def ghi --- abc def ghi --- Guile/srfi-48 Testing linefeeds... --- abc def ghi --- abc def ghi --- Gauche/srfi-48 Testing linefeeds... --- abc def ghi --- abc def ghi --- STklos/default Testing linefeeds... --- abc def ghi --- abc def ghi --- ============================================================================= I believe that the blank line between "abc" and "def" (which only occurs when I use srfi-48 under either Guile or Gauche) is spurious, Stephen Lewis