On the other hand I am careful to locate the style in a
mythical past. There is an unhappy history of the
style being taught as the one true way to program in Lisp,
even though it is a rather clumsy style for day
to day programming. For example, all my routines get reduced
to one liners by using CL's built-in functions.
(defun trad-count-CL (symbol start list)
(declare (ignore start))
(cons symbol (count symbol list)))
(defun find-types-CL(tokens types)
(declare (ignore types))
(remove-duplicates tokens))
(defun multi-count-CL (types tokens)
(loop for x in types collect (trad-count-CL x 0 tokens)))
(defun occurrences-CL (list)
(sort (multi-count-CL (find-types-CL list '())
list)
#'> :key #'cdr))
leading to
(defun occurrences-CL-condensed (list)
(sort (loop for x in (remove-duplicates list)
collect (cons x (count x list)))
#'> :key #'cdr))
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 304 |
Nodes: | 16 (2 / 14) |
Uptime: | 29:14:46 |
Calls: | 6,820 |
Files: | 12,335 |
Messages: | 5,406,682 |