Commit 3859c682 authored by nasciiboy's avatar 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
</div>
<p>The function should be passed the height of the graph, and then should construct and insert the appropriate numbers and marks.</p>
<p>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.</p>
<p>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 <code>10 -</code>, which is a multiple of five, and be higher than the topmost value of the graph?</p>
<p>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?</p>
<p>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 <code>(apply &#39;max numbers-list)</code>. 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.</p>
<p>As usual in cases like this, a complex problem becomes simpler if it is divided into several smaller problems.</p>
<p>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.</p>
......@@ -7205,25 +7205,25 @@ print-Y-axis
<span class="s">&#34;Print X axis labels to length of NUMBERS-LIST.&#34;</span>
<span class="p">(</span><span class="nb">let*</span> <span class="p">((</span><span class="nv">leading-spaces</span>
<span class="p">(</span><span class="nf">make-string</span> <span class="nv">full-Y-label-width</span> <span class="sc">? </span><span class="p">))</span>
<span class="c1">;; symbol-width is provided by graph-body-print</span>
<span class="p">(</span><span class="nv">tic-width</span> <span class="p">(</span><span class="nf">*</span> <span class="nv">symbol-width</span> <span class="nv">X-axis-label-spacing</span><span class="p">))</span>
<span class="p">(</span><span class="nv">X-length</span> <span class="p">(</span><span class="nf">length</span> <span class="nv">numbers-list</span><span class="p">))</span>
<span class="p">(</span><span class="nv">X-tic</span>
<span class="p">(</span><span class="nf">concat</span>
<span class="p">(</span><span class="nf">make-string</span>
<span class="c1">;; Make a string of blanks.</span>
<span class="p">(</span><span class="nf">-</span> <span class="p">(</span><span class="nf">*</span> <span class="nv">symbol-width</span> <span class="nv">X-axis-label-spacing</span><span class="p">)</span>
<span class="p">(</span><span class="nf">length</span> <span class="nv">X-axis-tic-symbol</span><span class="p">))</span>
<span class="sc">? </span><span class="p">)</span>
<span class="c1">;; Concatenate blanks with tic symbol.</span>
<span class="nv">X-axis-tic-symbol</span><span class="p">))</span>
<span class="p">(</span><span class="nv">tic-number</span>
<span class="p">(</span><span class="nb">if</span> <span class="p">(</span><span class="nv">zerop</span> <span class="p">(</span><span class="nf">%</span> <span class="nv">X-length</span> <span class="nv">tic-width</span><span class="p">))</span>
<span class="p">(</span><span class="nf">/</span> <span class="nv">X-length</span> <span class="nv">tic-width</span><span class="p">)</span>
<span class="p">(</span><span class="nf">1+</span> <span class="p">(</span><span class="nf">/</span> <span class="nv">X-length</span> <span class="nv">tic-width</span><span class="p">)))))</span>
<span class="p">(</span><span class="nv">print-X-axis-tic-line</span> <span class="nv">tic-number</span> <span class="nv">leading-spaces</span> <span class="nv">X-tic</span><span class="p">)</span>
<span class="p">(</span><span class="nf">insert</span> <span class="s">&#34;\n&#34;</span><span class="p">)</span>
<span class="p">(</span><span class="nv">print-X-axis-numbered-line</span> <span class="nv">tic-number</span> <span class="nv">leading-spaces</span><span class="p">)))</span>
<span class="c1">;; symbol-width is provided by graph-body-print</span>
<span class="p">(</span><span class="nv">tic-width</span> <span class="p">(</span><span class="nf">*</span> <span class="nv">symbol-width</span> <span class="nv">X-axis-label-spacing</span><span class="p">))</span>
<span class="p">(</span><span class="nv">X-length</span> <span class="p">(</span><span class="nf">length</span> <span class="nv">numbers-list</span><span class="p">))</span>
<span class="p">(</span><span class="nv">X-tic</span>
<span class="p">(</span><span class="nf">concat</span>
<span class="p">(</span><span class="nf">make-string</span>
<span class="c1">;; Make a string of blanks.</span>
<span class="p">(</span><span class="nf">-</span> <span class="p">(</span><span class="nf">*</span> <span class="nv">symbol-width</span> <span class="nv">X-axis-label-spacing</span><span class="p">)</span>
<span class="p">(</span><span class="nf">length</span> <span class="nv">X-axis-tic-symbol</span><span class="p">))</span>
<span class="sc">? </span><span class="p">)</span>
<span class="c1">;; Concatenate blanks with tic symbol.</span>
<span class="nv">X-axis-tic-symbol</span><span class="p">))</span>
<span class="p">(</span><span class="nv">tic-number</span>
<span class="p">(</span><span class="nb">if</span> <span class="p">(</span><span class="nv">zerop</span> <span class="p">(</span><span class="nf">%</span> <span class="nv">X-length</span> <span class="nv">tic-width</span><span class="p">))</span>
<span class="p">(</span><span class="nf">/</span> <span class="nv">X-length</span> <span class="nv">tic-width</span><span class="p">)</span>
<span class="p">(</span><span class="nf">1+</span> <span class="p">(</span><span class="nf">/</span> <span class="nv">X-length</span> <span class="nv">tic-width</span><span class="p">)))))</span>
<span class="p">(</span><span class="nv">print-X-axis-tic-line</span> <span class="nv">tic-number</span> <span class="nv">leading-spaces</span> <span class="nv">X-tic</span><span class="p">)</span>
<span class="p">(</span><span class="nf">insert</span> <span class="s">&#34;\n&#34;</span><span class="p">)</span>
<span class="p">(</span><span class="nv">print-X-axis-numbered-line</span> <span class="nv">tic-number</span> <span class="nv">leading-spaces</span><span class="p">)))</span>
</code></pre>
<p>You can test <code>print-X-axis</code>:</p>
<ol class="num" >
......
......@@ -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!
Please register or to comment