Re: sanity check (coding style)
- From: Brian Downing <see-signature@xxxxxxxxx>
- Date: Wed, 30 Nov 2005 01:26:41 GMT
In article <1133313533.141217.158020@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
josephoswaldgg@xxxxxxxxxxx <josephoswald@xxxxxxxxx> wrote:
> 2) I originally expected with-output-to-string to capture princ's
> output, and tried just
>
> (with-output-to-string (s) (map nil #'princ v) s)
>
> but of course princ still goes to *standard-ouput* without the extra
> argument, which requires an anonymous function.
(asdf:operate 'asdf:load-op :arnesi)
(with-output-to-string (s) (map nil (arnesi:rcurry #'princ s) v))
> I had expected to find
> a built-in macro to divert everything destined for a stream (defaulting
> to *standard-output*) to a string, then return that string.
(with-output-to-string (*standard-output*) (map nil #'princ v))
Remember, any binding construct with a special variable will make a
dynamic binding, not just LET and friends.
You also needn't return the string-stream out of the expression as you
did above. WITH-OUTPUT-TO-STRING always returns the generated string.
If it returned the stream you wouldn't get what you wanted.
-bcd
--
*** Brian Downing <bdowning at lavos dot net>
.
- Follow-Ups:
- Re: sanity check (coding style)
- From: josephoswaldgg@xxxxxxxxxxx
- Re: sanity check (coding style)
- References:
- sanity check (coding style)
- From: Sylvain
- Re: sanity check (coding style)
- From: Christophe Rhodes
- Re: sanity check (coding style)
- From: Sylvain
- Re: sanity check (coding style)
- From: josephoswaldgg@xxxxxxxxxxx
- sanity check (coding style)
- Prev by Date: Re: sanity check (coding style)
- Next by Date: Re: a clisp problem
- Previous by thread: Re: sanity check (coding style)
- Next by thread: Re: sanity check (coding style)
- Index(es):