Series で L-99 P09-12
;; P12 (**) Decode a run-length encoded list.
;; Given a run-length code list generated as specified in problem P11. Construct its uncompressed version.
(defun decode-run-length (x)
(collect-append
(mapping ((e x))
(destructuring-bind (n v) (if (atom e)
(list 1 e)
e)
(make-list n :initial-element v)))))
(decode-run-length #z((4 a) b (2 c) (2 a) d (4 e)))