(defn reducer
  "Returns a reduction closure the terminates when pred is false. Applies f to the last value that returns true. f defaults to identity if not provided. Behaves like reduce if pred is always true."
  ([pred] (reducer pred identity))
  ([pred f] (do-stuff:TBD))
When you're right folding rather than left folding, this can be done lazily without a separate predicate:
ReplyDeletehttp://gist.github.com/337568