From: Mark Tarver
Subject: FORMAT ~{~A ~} and carriage return
Date: 
Message-ID: <1182090827.136506.322630@q69g2000hsb.googlegroups.com>
Here is (FORMAT "~{~A ~}" '(1 2 3)) in CLisp.

(FORMAT "~{~A ~}" '(1 2 3))
==> "1 2 3 "

Here is  (FORMAT NIL "~{~A ~}" (LIST 1 2 *help*))  where
*help* is a longish string.

viz. *help* is
"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.
"

We get

(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.
"

It seem that a carriage return has been thrown in after 2.  Is this
part of the spec or is it a bug?

Mark

From: Rob Warnock
Subject: Re: FORMAT ~{~A ~} and carriage return
Date: 
Message-ID: <jvGdnZhEOZRB0-jbnZ2dnUVZ_qKqnZ2d@speakeasy.net>
Mark Tarver  <··········@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.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Vassil Nikolov
Subject: Re: FORMAT ~{~A ~} and carriage return
Date: 
Message-ID: <ka8xaioa4w.fsf@localhost.localdomain>
On Sun, 17 Jun 2007 14:33:47 -0000, Mark Tarver <··········@ukonline.co.uk> said:
| ...
| It seem that a carriage return has been thrown in after 2.  Is this
| part of the spec or is it a bug?

  It is most likely because of pretty-printing.  One quick "fix" is to
  (SETQ *PRINT-PRETTY* NIL).

  (By the way, "new line", please, rather than "carriage return".)

  ---Vassil.


-- 
The truly good code is the obviously correct code.
From: Mark Tarver
Subject: Re: FORMAT ~{~A ~} and carriage return
Date: 
Message-ID: <1182090898.647967.151390@u2g2000hsc.googlegroups.com>
On 17 Jun, 15:33, Mark Tarver <··········@ukonline.co.uk> wrote:
> Here is (FORMAT "~{~A ~}" '(1 2 3)) in CLisp.
>
> (FORMAT "~{~A ~}" '(1 2 3))
> ==> "1 2 3 "
>
> Here is  (FORMAT NIL "~{~A ~}" (LIST 1 2 *help*))  where
> *help* is a longish string.
>
> viz. *help* is
> "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 fromwww.lambdassociates.org.
> "
>
> We get
>
> (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 fromwww.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?
>
> Mark

Oh, I should have written FORMAT NIL ... Take it as read.

Mark
From: Pascal Bourguignon
Subject: Re: FORMAT ~{~A ~} and carriage return
Date: 
Message-ID: <87abuyipf8.fsf@thalassa.lan.informatimago.com>
Mark Tarver <··········@ukonline.co.uk> writes:

> Here is (FORMAT "~{~A ~}" '(1 2 3)) in CLisp.
>
> (FORMAT "~{~A ~}" '(1 2 3))
> ==> "1 2 3 "
>
> Here is  (FORMAT NIL "~{~A ~}" (LIST 1 2 *help*))  where
> *help* is a longish string.
>
> viz. *help* is
> "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.
> "
>
> We get
>
> (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.
> "
>
> It seem that a carriage return has been thrown in after 2.  Is this
> part of the spec or is it a bug?

Part of the spec AFAIK.
Try: 

(let ((*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.
"))

   (let ((*print-pretty* nil))
      (format nil "~{~A ~}" (list 1 2 *help*))))


Note that the  initial value of *print-pretty* (and most other such
variables) is implementation-dependant.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.