Skip to content

Instantly share code, notes, and snippets.

@pervognsen
Created March 19, 2010 14:58
Show Gist options
  • Save pervognsen/337568 to your computer and use it in GitHub Desktop.
Save pervognsen/337568 to your computer and use it in GitHub Desktop.
(defn lazy-fold [f val coll]
(letfn [(helper [coll]
(if (seq coll)
(f (first coll) (delay (helper (rest coll))))
(delay val)))]
(force (helper coll))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment