To find the description for this, it first needs to look up the
spot in the map that points to the living-room. The
assoc command does this and then returns the data
describing the living-room. Then the command second
trims out the second item in that list, which is the
description of the living-room (If you look at the map
variable we had created, the snippet of text describing the
living-room was the second item in the list that
contained all the data about the living room...)
|
Now let's use our Emacs scratch buffer to test our function.
Again, like all the text in this font and color,
copy and paste the following text into your Emacs
*scratch* buffer, move the cursor to the end of it,
and type C-x C-e to execute it:
|
(describe-location 'living-room map)
|
If you copied all the code into the Emacs *scratch*
buffer correctly up to this point, you should see the following
message:
|
==> (you are in the living-room of a wizards house -
there is a wizard snoring loudly on the couch -)
|
Perfect! Just what we wanted! Notice how we put a quote in
front of the symbol living-room, since this symbol is
just a piece of data naming the location (i.e., we want it read
in Data mode), but why didn't we put a quote in front of
the symbol map, since in this case we want the Lisp
interpreter to hunt down the data stored in the map
variable (i.e., we want the compiler to be in Code mode
and not just look at the word map as a chunk of raw data).
|
<< begin
< previous -
next >
end >>
|