Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
15 lines (13 sloc) 336 Bytes
; P12 Decode a run-length encoded list.
; Mapping
(defn f1 [l]
(defn f [x] (if (vector? x) (repeat (first x) (second x)) x))
(flatten (map f l)))
; Recursion
(defn f2 [l]
(if (seq l)
(let [h (first l) t (rest l)]
(if (vector? h)
(concat (repeat (first h) (second h)) (f2 t))
(cons h (f2 t))))
'()))