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