From: dstein64
Subject: How to lookup
Date: 
Message-ID: <697390c3-5bf0-4783-9b6c-1c9142c97e66@l42g2000hsc.googlegroups.com>
I am trying to lookup what the #. in #.*standard-output* stands for.
Unfortunately, Google ignores some of the characters in my search.
What does #. do in common lisp. It came up on a threads tutorial I am
reading. Also, how can I look up stuff like this (on google, common
lisp references, ...). I am assuming that it is syntactic sugar for
some other function, just as #' is syntactic sugar for the 'function'
function and #(....) is for making vectors... Any help would be great
(on what #. is for and on how to look stuff like that up). Thanks.

From: Thomas A. Russ
Subject: Re: How to lookup
Date: 
Message-ID: <ymizls5z5wp.fsf@blackcat.isi.edu>
dstein64 <········@gmail.com> writes:

> I am trying to lookup what the #. in #.*standard-output* stands for.

It is a read-time evaluation of the value of the next lisp form.  The
use with *standard-output* looks a bit strange to me, since it isn't at
all clear that this would work in compiled code, where the output stream
at compile time might not really be valid anymore at run time.

> Unfortunately, Google ignores some of the characters in my search.
> What does #. do in common lisp. It came up on a threads tutorial I am
> reading. Also, how can I look up stuff like this (on google, common
> lisp references, ...).

Well, the authoritative resource for reference-type questions about
Common Lisp is the hyperspec, an html version of the ANSI specification
document.  You can find it at

   http://www.lisp.org/HyperSpec/FrontMatter/index.html
or
   http://www.lispworks.com/documentation/HyperSpec/Front/index.htm


> I am assuming that it is syntactic sugar for
> some other function, just as #' is syntactic sugar for the 'function'
> function and #(....) is for making vectors... Any help would be great
> (on what #. is for and on how to look stuff like that up). Thanks.

Actually, things beginning with # are reader macros.  They affect the
way things are read.  In some cases, this is used as syntactic sugar,
but at other times, different effects happen, such as making vectors or
even evaluating things at read time.

It was actually fairly common at one time to use the #. reader macro to
introduce constant values into the code in a more readable manner:

  (defparameter *seconds-per-day* #.(* 24 60 60))

which would cause the multiplication to happen during reading of the
form.  You can look at the differences among some of these things by
trying 

   (read-from-string "(* 24 60 60)")
   (read-from-string "#.(* 24 60 60)")
   (read-from-string "#(* 24 60 60)")


-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Kent M Pitman
Subject: Re: How to lookup
Date: 
Message-ID: <ulk3pqk5u.fsf@nhplace.com>
···@sevak.isi.edu (Thomas A. Russ) writes:

> dstein64 <········@gmail.com> writes:
> 
> > I am trying to lookup what the #. in #.*standard-output* stands for.
> 
> It is a read-time evaluation of the value of the next lisp form.  The
> use with *standard-output* looks a bit strange to me, since it isn't at
> all clear that this would work in compiled code, where the output stream
> at compile time might not really be valid anymore at run time.

Indeed, there's no a priori reason to assume that the value of
*standard-output* is externalizable, so the uses to which
#.*standard-output* can be put are few and quite suspect.
From: Zach Beane
Subject: Re: How to lookup
Date: 
Message-ID: <m38wzpjxi7.fsf@unnamed.xach.com>
dstein64 <········@gmail.com> writes:

> I am trying to lookup what the #. in #.*standard-output* stands for.
> Unfortunately, Google ignores some of the characters in my search.
> What does #. do in common lisp. It came up on a threads tutorial I am
> reading. Also, how can I look up stuff like this (on google, common
> lisp references, ...). I am assuming that it is syntactic sugar for
> some other function, just as #' is syntactic sugar for the 'function'
> function and #(....) is for making vectors... Any help would be great
> (on what #. is for and on how to look stuff like that up). Thanks.

I use http://xach.com/clhs about a hundred times a day to look up
stuff like that. For example:

  http://xach.com/clhs?q=%23.

  http://xach.com/clhs?q=11.1.2.1.2

  http://xach.com/clhs?q=%7ET

  http://xach.com/clhs?q=%23%28

  http://xach.com/clhs?q=list-all-packages

A little more info is available at http://xach.com/lisp/clhs-lookup/ .

Hope it helps!

Zach
From: Peder O. Klingenberg
Subject: Re: How to lookup
Date: 
Message-ID: <kszls5fpqt.fsf@beto.netfonds.no>
dstein64 <········@gmail.com> writes:

> I am trying to lookup what the #. in #.*standard-output* stands for.

Like #', it's a reader macro.  Reader macros make the lisp reader do
stuff above and beyond the straightforward conversion of charaters to
lisp objects.  Unlike #', #. is not merely shorthand for a longer
function name.  #. means that the following form should be evaluated
at read time.  So #.*standard-output* means that *standard-output*
should be evaluated when the code is read, not at runtime (or
compile-time or macro-expand-time or load-time).

The standard sharpsign reader macros are explained in the Hyperspec,
section 2.4.8:
<http://www.lispworks.com/documentation/HyperSpec/Body/02_dh.htm> 

...Peder...
-- 
I wish a new life awaited _me_ in some off-world colony.
From: Pascal J. Bourguignon
Subject: Re: How to lookup
Date: 
Message-ID: <7c7if8okul.fsf@pbourguignon.anevia.com>
dstein64 <········@gmail.com> writes:

> I am trying to lookup what the #. in #.*standard-output* stands for.
> Unfortunately, Google ignores some of the characters in my search.
> What does #. do in common lisp. It came up on a threads tutorial I am
> reading. Also, how can I look up stuff like this (on google, common
> lisp references, ...). I am assuming that it is syntactic sugar for
> some other function, just as #' is syntactic sugar for the 'function'
> function and #(....) is for making vectors... Any help would be great
> (on what #. is for and on how to look stuff like that up). Thanks.

Ask specbot, on irc://irc.freenode.org/#lisp

2008-04-08 09:40
<matimago> clhs #.
<specbot> http://www.lispworks.com/reference/HyperSpec/Body/02_dhf.htm
#lisp 

-- 
__Pascal Bourguignon__