Commit 3859c682 by nasciiboy

-------------------------------------------------------

```   po hero (REBOOT II½) ...................... ~DONE
-------------------------------------------------------
modified:   emacs-lisp-intro.morg
modified:   emacs-lisp-intro.html
modified:   emacs-lisp-intro_es.porg
modified:   emacs-lisp-intro_es.morg
modified:   emacs-lisp-intro_es.html
-------------------------------------------------------
Sonic-Boom
-------------------------------------------------------
DJ Shadow ! Live In Manchester
Blur      : Modern Life Is Rubbish
: Modern Life Is Rubbish (Bonus Material)
: Parklife
-------------------------------------------------------```
parent 582ab215
 ... ... @@ -6896,7 +6896,7 @@ fifth bit of text

The function should be passed the height of the graph, and then should construct and insert the appropriate numbers and marks.

It is easy enough to see in the figure what the Y axis label should look like; but to say in words, and then to write a function definition to do the job is another matter. It is not quite true to say that we want a number and a tic every five lines: there are only three lines between the ‘1’ and the ‘5’ (lines 2, 3, and 4), but four lines between the ‘5’ and the ‘10’ (lines 6, 7, 8, and 9). It is better to say that we want a number and a tic mark on the base line (number 1) and then that we want a number and a tic on the fifth line from the bottom and on every line that is a multiple of five.

The next issue is what height the label should be? Suppose the maximum height of tallest column of the graph is seven. Should the highest label on the Y axis be ‘5 -’, and should the graph stick up above the label? Or should the highest label be ‘7 -’, and mark the peak of the graph? Or should the highest label be 10 -, which is a multiple of five, and be higher than the topmost value of the graph?

The next issue is what height the label should be? Suppose the maximum height of tallest column of the graph is seven. Should the highest label on the Y axis be ‘5 -’, and should the graph stick up above the label? Or should the highest label be ‘7 -’, and mark the peak of the graph? Or should the highest label be ‘10 -’, which is a multiple of five, and be higher than the topmost value of the graph?

The latter form is preferred. Most graphs are drawn within rectangles whose sides are an integral number of steps long––5, 10, 15, and so on for a step distance of five. But as soon as we decide to use a step height for the vertical axis, we discover that the simple expression in the varlist for computing the height is wrong. The expression is (apply 'max numbers-list). This returns the precise height, not the maximum height plus whatever is necessary to round up to the nearest multiple of five. A more complex expression is required.

As usual in cases like this, a complex problem becomes simpler if it is divided into several smaller problems.

First, consider the case when the highest value of the graph is an integral multiple of five––when it is 5, 10, 15, or some higher multiple of five. We can use this value as the Y axis height.

... ... @@ -7205,25 +7205,25 @@ print-Y-axis "Print X axis labels to length of NUMBERS-LIST." (let* ((leading-spaces (make-string full-Y-label-width ? )) ;; symbol-width is provided by graph-body-print (tic-width (* symbol-width X-axis-label-spacing)) (X-length (length numbers-list)) (X-tic (concat (make-string ;; Make a string of blanks. (- (* symbol-width X-axis-label-spacing) (length X-axis-tic-symbol)) ? ) ;; Concatenate blanks with tic symbol. X-axis-tic-symbol)) (tic-number (if (zerop (% X-length tic-width)) (/ X-length tic-width) (1+ (/ X-length tic-width))))) (print-X-axis-tic-line tic-number leading-spaces X-tic) (insert "\n") (print-X-axis-numbered-line tic-number leading-spaces))) ;; symbol-width is provided by graph-body-print (tic-width (* symbol-width X-axis-label-spacing)) (X-length (length numbers-list)) (X-tic (concat (make-string ;; Make a string of blanks. (- (* symbol-width X-axis-label-spacing) (length X-axis-tic-symbol)) ? ) ;; Concatenate blanks with tic symbol. X-axis-tic-symbol)) (tic-number (if (zerop (% X-length tic-width)) (/ X-length tic-width) (1+ (/ X-length tic-width))))) (print-X-axis-tic-line tic-number leading-spaces X-tic) (insert "\n") (print-X-axis-numbered-line tic-number leading-spaces)))

You can test print-X-axis:

... ...
 ... ... @@ -14037,7 +14037,7 @@ promoting software freedom.” height of tallest column of the graph is seven. Should the highest label on the Y axis be @'{5 -}, and should the graph stick up above the label? Or should the highest label be @'{7 -}, and mark the peak of the graph? Or should the highest label be @c{10 -}, which is a multiple of five, and Or should the highest label be @'{10 -}, which is a multiple of five, and be higher than the topmost value of the graph? The latter form is preferred. Most graphs are drawn within rectangles ... ... @@ -14300,7 +14300,6 @@ promoting software freedom.” the @c{make-string} function. The base line consists of the number one followed by a tic mark. *** The Not Quite Final Version of @c{print-Y-axis} The list constructed by the @c{Y-axis-column} function is passed to the ... ... @@ -14488,7 +14487,6 @@ promoting software freedom.” (1+ (/ (X-length tic-width)))) < src.. All this leads us directly to the function for printing the X axis tic line: ... ... @@ -14561,31 +14559,31 @@ promoting software freedom.” The function consists of a varlist that specifies five local variables, and calls to each of the two line printing functions: ..src > elisp (defun print-X-axis (numbers-list) "Print X axis labels to length of NUMBERS-LIST." (let* ((leading-spaces (make-string full-Y-label-width ? )) ;; symbol-width is provided by graph-body-print (tic-width (* symbol-width X-axis-label-spacing)) (X-length (length numbers-list)) (X-tic (concat (make-string ;; Make a string of blanks. (- (* symbol-width X-axis-label-spacing) (length X-axis-tic-symbol)) ? ) ;; Concatenate blanks with tic symbol. X-axis-tic-symbol)) (tic-number (if (zerop (% X-length tic-width)) (/ X-length tic-width) (1+ (/ X-length tic-width))))) ..src > elisp (defun print-X-axis (numbers-list) "Print X axis labels to length of NUMBERS-LIST." (let* ((leading-spaces (make-string full-Y-label-width ? )) ;; symbol-width is provided by graph-body-print (tic-width (* symbol-width X-axis-label-spacing)) (X-length (length numbers-list)) (X-tic (concat (make-string ;; Make a string of blanks. (- (* symbol-width X-axis-label-spacing) (length X-axis-tic-symbol)) ? ) ;; Concatenate blanks with tic symbol. X-axis-tic-symbol)) (tic-number (if (zerop (% X-length tic-width)) (/ X-length tic-width) (1+ (/ X-length tic-width))))) (print-X-axis-tic-line tic-number leading-spaces X-tic) (insert "\n") (print-X-axis-numbered-line tic-number leading-spaces))) < src.. < src.. You can test @c{print-X-axis}: ... ...
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!