Re: A library function for the repeated application of a lambda with values from a sequence

2013-09-14 Thread Bogdan Opanchuk
Hi Cedric, Thanks, I'm feeling really silly now... I should have thought about folds the first second after encountering this :) -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note t

Re: A library function for the repeated application of a lambda with values from a sequence

2013-09-14 Thread Cedric Greevey
Why not just (reduce func v l)? On Sat, Sep 14, 2013 at 8:12 AM, Bogdan Opanchuk wrote: > Hello, > > Consider the following problem: > > (def v [1 2 3]) > (def l '(4 5 6)) > > ; we need to apply in sequence > ; `v <- (func v e)`, > ; where `e` goes over elements of the list `l` > (def new-v (ap

A library function for the repeated application of a lambda with values from a sequence

2013-09-14 Thread Bogdan Opanchuk
Hello, Consider the following problem: (def v [1 2 3]) (def l '(4 5 6)) ; we need to apply in sequence ; `v <- (func v e)`, ; where `e` goes over elements of the list `l` (def new-v (apply-from-list func v l)) For example, if `(def func conj)`, then the value of `new-v` is `[1 2 3 4 5 6]`. I