Skip to content

Instantly share code, notes, and snippets.

@matko
Created June 11, 2013 11:05
Show Gist options
  • Save matko/5756075 to your computer and use it in GitHub Desktop.
Save matko/5756075 to your computer and use it in GitHub Desktop.
function generator that converts a sequence to a fragmented and timed lazy seq, with parameters alterable after seq construction.
(defn generate-configured-timed-lazy-seq-fn [delay fragment-size]
(fn blah [c]
(if (seq c)
(lazy-seq
(let [delay @delay
fragment-size @fragment-size]
(Thread/sleep delay)
(cons
(take fragment-size c)
(blah (nthrest c fragment-size))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment