Skip to content

Instantly share code, notes, and snippets.

@ohpauleez
Created September 23, 2010 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohpauleez/594584 to your computer and use it in GitHub Desktop.
Save ohpauleez/594584 to your computer and use it in GitHub Desktop.
(defn step-seq [result n]
(if (= n 1)
result
(recur (conj result (step n))
(step n))))
(defn step-seq! [n]
(loop [result (transient [])
cnt n]
(if (= cnt 1)
(persistent! result)
(recur (conj! result (step cnt))
(step cnt)))))
(defn step-seq-endn! [n end-n]
(loop [result (transient [])
cnt n]
(if (= cnt end-n)
(persistent! result)
(recur (conj! result (step cnt))
(step cnt)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment