Skip to main content

The Craft of Emacs

Evaluation: S-expressions and special forms

1 hour

Here’s a copy of the code you’ve written:

(defunxx
()
(interactive)
(get‑buffer‑create"*xx*")
(switch‑to‑buffer"*xx*")
(erase‑buffer)
(xx‑‑insert‑line"Skeins")
(xx‑‑insert‑line"======")
(let
(
(strands
(read‑string"No. strands: ")
)
(stitches
(read‑string"No. stitches: ")
)
)
(xx‑‑insert‑line
(concat"No. strands: "strands)
)
(xx‑‑insert‑line
(concat"No. stitches: "stitches)
)
(xx‑‑insert‑line
(concat"No. skeins: "
(number‑to‑string
(xx‑‑num‑skeins
(string‑to‑numberstrands)
(string‑to‑numberstitches)
)
)
)
)
)
)
(defunxx‑‑insert‑line
(text)
(inserttext)
(newline)
)
(defunxx‑‑num‑skeins
(strandsstitches)
(ceiling
(/
(float
(*strandsstitches)
)
4800.0)
)
)
xx.el