Programming in Emacs Lisp
C.2.3 Create a Y Axis Column
The preceding functions provide all the tools needed to construct a
function that generates a list of numbered and blank strings to insert
as the label for the vertical axis:
 (defun Yaxiscolumn (height widthoflabel)
"Construct list of Y axis labels and blank strings.
For HEIGHT of line above base and WIDTHOFLABEL."
(let (Yaxis)
(while (> height 1)
(if (zerop (% height Yaxislabelspacing))
;; Insert label.
(setq Yaxis
(cons
(Yaxiselement height widthoflabel)
Yaxis))
;; Else, insert blanks.
(setq Yaxis
(cons
(makestring widthoflabel ? )
Yaxis)))
(setq height (1 height)))
;; Insert base line.
(setq Yaxis
(cons (Yaxiselement 1 widthoflabel) Yaxis))
(nreverse Yaxis)))

In this function, we start with the value of height
and
repetitively subtract one from its value. After each subtraction, we
test to see whether the value is an integral multiple of the
Yaxislabelspacing
. If it is, we construct a numbered label
using the Yaxiselement
function; if not, we construct a
blank label using the makestring
function. The base line
consists of the number one followed by a tic mark.