Subject: Re: FORMAT ~{~A ~} and carriage return
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 17 Jun 2007 10:10:20 -0500
Newsgroups: comp.lang.lisp
Message-ID: <jvGdnZhEOZRB0-jbnZ2dnUVZ_qKqnZ2d@speakeasy.net>
Mark Tarver  <dr.mtarver@ukonline.co.uk> wrote:
+---------------
| Here is (FORMAT "~{~A ~}" '(1 2 3)) in CLisp.
| 
| (FORMAT "~{~A ~}" '(1 2 3))
| ==> "1 2 3 "
+---------------

By the way, remember that you can use "~^" to get rid of that
final (usually superfluous) space:

    > (format nil "~{~A~^ ~}" '(1 2 3))

    "1 2 3"
    >

+---------------
| Here is  (FORMAT NIL "~{~A ~}" (LIST 1 2 *help*))  where
| *help* is a longish string.
...
| We get
| (FORMAT NIL "~{~A ~}" (LIST 1 2 *help*))
| ==> "1 2
| File            enables the loading and compilation of source programs
...
| Update          loads the latest updates from www.lambdassociates.org.
| "
| 
| It seem that a carriage return has been thrown in after 2.
| Is this part of the spec or is it a bug?
+---------------

Looks like a bug. Works fine in CMUCL:

    > *help*

    "File            enables the loading and compilation of source programs in Qi and Lisp.
    TC?             toggles type checking.
    Spy?            toggles the Qi spy command.
    Terminal        exits to terminal mode - GUIs are not read.
    Track           tracks chosen function(s).
    Profile         tracks chosen function(s).
    Update          loads the latest updates from www.lambdassociates.org.
    "
    > (format nil "~{~A ~}" (list 1 2 *help*))

    "1 2 File            enables the loading and compilation of source programs in Qi and Lisp.
    TC?             toggles type checking.
    Spy?            toggles the Qi spy command.
    Terminal        exits to terminal mode - GUIs are not read.
    Track           tracks chosen function(s).
    Profile         tracks chosen function(s).
    Update          loads the latest updates from www.lambdassociates.org.
     "
    > 

Note the superluous final space (which is why I suggested using "~^").


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607