The description of format in
http://www.lispworks.com/reference/HyperSpec/Body/f_format.htm
doesn't say where (format t ...) is supposed send its output.
(*standard-output*, I know.) I've been searching through the CLHS,
and I can't find it anywhere other than in a few examples. Could
this a bug in the spec?
Lars Brinkhoff <·········@nocrew.org> writes:
> The description of format in
>
> http://www.lispworks.com/reference/HyperSpec/Body/f_format.htm
>
> doesn't say where (format t ...) is supposed send its output.
> (*standard-output*, I know.) I've been searching through the CLHS,
> and I can't find it anywhere other than in a few examples. Could
> this a bug in the spec?
Look in the glossary entry for stream designator.
--
There is only one war, and it's not the rich against the poor,
the blacks against the whites, the Federation against the Borg,
or the Democrats versus the Republicans. It's those of us who
aren't complete idiots against those of us who are.
Lieven Marchand <···············@just.fgov.be> writes:
> Lars Brinkhoff <·········@nocrew.org> writes:
> > The description of format in
> > http://www.lispworks.com/reference/HyperSpec/Body/f_format.htm
> > doesn't say where (format t ...) is supposed send its output.
> > I've been searching through the CLHS, and I can't find it anywhere
> > other than in a few examples. Could this a bug in the spec?
> Look in the glossary entry for stream designator.
That doesn't help. t denotes the value of *standard-output* when
passed to format, but as a stream designator, it denotes the value
of *terminal-io*.
So my question still stands.
http://www.lispworks.com/reference/HyperSpec/Body/22_cl.htm
"Note that the meaning of nil and t as destinations to format are
different than those of nil and t as stream designators"
* Lars Brinkhoff wrote:
> So my question still stands.
> http://www.lispworks.com/reference/HyperSpec/Body/22_cl.htm
> "Note that the meaning of nil and t as destinations to format are
> different than those of nil and t as stream designators"
Section 22.3:
format sends the output to destination. If destination is nil,
format creates and returns a string containing the output from
control-string. If destination is non-nil, it must be a string
with a fill pointer, a stream, or the symbol t. If destination is
a string with a fill pointer, the output is added to the end of
the string. If destination is a stream, the output is sent to that
stream. If destination is t, the output is sent to standard
output.
There must be a less obscure place it says this...
--tim
Tim Bradshaw <···@cley.com> writes:
> * Lars Brinkhoff wrote:
> > So my question still stands.
> Section 22.3:
Oh, thanks. Google doesn't seem to find "standard output" in there.
Lars Brinkhoff wrote:
>>Section 22.3:
>
> Oh, thanks. Google doesn't seem to find "standard output" in there.
Google is probably not the optimal tool for searching languages
specifications. It is designed to search the whole web.
There is a htdig search of the ANS running on the Franz website.
See http://www.franz.com/search/
"Steven M. Haflich" <·················@alum.mit.edu> writes:
> Lars Brinkhoff wrote:
> >> Section 22.3:
> > Oh, thanks. Google doesn't seem to find "standard output" in there.
> Google is probably not the optimal tool for searching languages
> specifications. It is designed to search the whole web.
Right. Using search strings like
site:lispworks.com CLHS format "standard output"
I was hoping it would find all relevant pages, but it didn't.
> There is a htdig search of the ANS running on the Franz website.
> See http://www.franz.com/search/
Excellent, that one works much better. Thanks!
Lars Brinkhoff <·········@nocrew.org> writes:
> Lieven Marchand <···············@just.fgov.be> writes:
> > Lars Brinkhoff <·········@nocrew.org> writes:
> > > The description of format in
> > > http://www.lispworks.com/reference/HyperSpec/Body/f_format.htm
> > > doesn't say where (format t ...) is supposed send its output.
> > > I've been searching through the CLHS, and I can't find it anywhere
> > > other than in a few examples. Could this a bug in the spec?
> > Look in the glossary entry for stream designator.
>
> That doesn't help. t denotes the value of *standard-output* when
> passed to format, but as a stream designator, it denotes the value
> of *terminal-io*.
>
> So my question still stands.
>
> http://www.lispworks.com/reference/HyperSpec/Body/22_cl.htm
>
> "Note that the meaning of nil and t as destinations to format are
> different than those of nil and t as stream designators"
It's in the paragraph just after figure 22-6 (Examples of format control
strings) in section 22.3 (Formatted Output).
http://www.lispworks.com/reference/HyperSpec/Body/22_c.htm
You're right it's not the same as a stream designator, which is why it's
not described that way.
I don't know for sure, but my suspicion is (a) it was derived independently
and (b) there was _strong_ pressure to use T to mean the most common
destination to not sacrifice horizontal screen space. It's _very_ rare
to want to output to *terminal-io*. Also, NIL meant "no output" so was
the natural one for consing a string. The T/NIL in stream designators
go back much, much farther to Maclisp's "new I/O" which took arguments this
way. NIL meant "don't use the new I/O streams, but instead use the
old I/O destinations (which amounted to saying use what you'd now call
stdin/stdout)" while T was shorthand for TYI or TYO (which were short for
tty input and tty output, and were related by (status ttycons tyi) => #.tyo
and (status ttycons tyo) => #.tyi, so that they were the approximate
effect of *terminal-io* and the mapping was natural to continue into CL).
There was lots of pre-existing FORMAT code that had to be ported from
Maclisp to CL when CL came along.