Buy the book!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
In writing the
print-graph function, the first task is to write
the varlist in the
let expression. (We will leave aside for the
moment any thoughts about making the function interactive or about the
contents of its documentation string.)
The varlist should set several values. Clearly, the top of the label
for the vertical axis must be at least the height of the graph, which
means that we must obtain this information here. Note that the
print-graph-body function also requires this information. There
is no reason to calculate the height of the graph in two different
places, so we should change
print-graph-body from the way we
defined it earlier to take advantage of the calculation.
Similarly, both the function for printing the X axis labels and the
print-graph-body function need to learn the value of the width of
each symbol. We can perform the calculation here and change the
print-graph-body from the way we defined it in the
The length of the label for the horizontal axis must be at least as long as the graph. However, this information is used only in the function that prints the horizontal axis, so it does not need to be calculated here.
These thoughts lead us directly to the following form for the varlist
(let ((height (apply 'max numbers-list)) ; First version. (symbol-width (length graph-blank)))
As we shall see, this expression is not quite right.
|webmaster||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|