Skip to content

Instantly share code, notes, and snippets.

@simonjefford
Created September 5, 2012 16:45

Revisions

  1. simonjefford revised this gist Sep 5, 2012. 1 changed file with 1 addition and 5 deletions.
    6 changes: 1 addition & 5 deletions gistfile1.clj
    Original file line number Diff line number Diff line change
    @@ -1,5 +1 @@
    (fn [coll n]
    (loop [output [] input coll]
    (if (seq input)
    (recur (concat output (repeat n (first input))) (next input))
    output)))
    (fn [coll n] (mapcat #(repeat n %) coll))
  2. simonjefford revised this gist Sep 5, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.clj
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    (fn [coll n]
    (loop [output [] input coll]
    (if (seq input)
    (recur (concat output (repeat n (first input))) (next input))
    output)))
    (recur (concat output (repeat n (first input))) (next input))
    output)))
  3. simonjefford created this gist Sep 5, 2012.
    5 changes: 5 additions & 0 deletions gistfile1.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    (fn [coll n]
    (loop [output [] input coll]
    (if (seq input)
    (recur (concat output (repeat n (first input))) (next input))
    output)))