Re: FORMAT ~<...~:@> PUZZLE
- From: Vladimir Zolotykh <gsmith@xxxxxxxxxxxxx>
- Date: Tue, 29 Nov 2005 19:01:48 +0200
Peter Seibel wrote:
Vladimir Zolotykh <gsmith@xxxxxxxxxxxxx> writes:
The following simple function (defun foo (n) (let* ((*print-right-margin* n) (a '("Whan" "you're" "lost" "in" "the" "Wild," "and" "you're" "scared" "as" "a" "child," "And" "Death" "looks" "you" "bang" "in" "the" "eye,"))) (format t "~@<~{~A~^ ~}~:@>" a))) if called (cl-user::foo 10) prints one word at a line. So does (cl-user::foo 20),30,40. And only (cl-user::foo 50) prints
Whan you're lost in the Wild, and you're scared as a child, And Death looks you bang in the eye,
What's wrong? I'd expect that calls with n less that 50 (e.g 20, 30, 40) would also print _formatted_ paragraph. Where was I wrong?
I'm sure I don't actually understand this but poking around a bit I came up with this:
(defun foo (n) (let ((*print-right-margin* n) (*print-miser-width* nil) (a '("Whan" "you're" "lost" "in" "the" "Wild," "and" "you're" "scared" "as" "a" "child," "And" "Death" "looks" "you" "bang" "in" "the" "eye,"))) (format t "~@<~;~{~A~^ ~}~;~:@>" a)))
Yes, it's kikd of a mistery. I sure understand less then nothing in the HyperSec section for *PRINT-MISER-WIDTH*, what's the "miser style" of output mentioned there?
-Peter
-- Vladimir Zolotykh .
- Follow-Ups:
- Re: FORMAT ~<...~:@> PUZZLE
- From: Peter Seibel
- Re: FORMAT ~<...~:@> PUZZLE
- References:
- FORMAT ~<...~:@> PUZZLE
- From: Vladimir Zolotykh
- Re: FORMAT ~<...~:@> PUZZLE
- From: Peter Seibel
- FORMAT ~<...~:@> PUZZLE
- Prev by Date: Re: Hints on recursion
- Next by Date: Re: FORMAT ~<...~:@> PUZZLE
- Previous by thread: Re: FORMAT ~<...~:@> PUZZLE
- Next by thread: Re: FORMAT ~<...~:@> PUZZLE
- Index(es):
Relevant Pages
|