Skip to content

Instantly share code, notes, and snippets.

/gist:246622
Created Dec 1, 2009

Embed
What would you like to do?
(def qq [ 1 -1 3 4 -4 -5 6 -10 1345 -32 ] )
(defn filter-neg[g]
(if (neg? g)
[ g (* -1 g)]))
(filter-neg 3)
(defn produce-with-fun[x prod-fun]
(lazy-seq
(when (seq x)
(if-let [f (prod-fun (first x))]
(cons f (red (rest x) prod-fun))
(red (rest x) prod-fun)))))
(produce-with-fun qq filter-neg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.