On Sunday, 20 July 2014 12:48:19 UTC+1, Cecil Westerhof wrote: > or is there a better way? >
Probably not the answer you're looking for, but the exponentially-weighted moving average doesn't require any state other than the current value: (defn ewma [alpha] (fn [avg new] (+ (* (- 1 alpha) avg) (* alpha new)))) Jony -- 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 that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.