Yes, sorry, I didn't mean reduce, I meant reductions. - James
On 1 May 2014 21:35, Guru Devanla <grd...@gmail.com> wrote: > Reduce is not lazy, correct? Will it ever return for drop-while to > execute. The problem here is not knowing how many iterations make up the > sum, isnt? > > > On Thu, May 1, 2014 at 1:13 PM, James Reeves <ja...@booleanknot.com>wrote: > >> I'd suggest generating an intermediate seq with the summed time: >> >> (defn state [time] >> (->> (thomsons-lamp) >> (reduce (fn [[_ t] [onoff dur]] [onoff (+ t dur)])) >> (drop-while (fn [[_ t]] (< t time))) >> first second)) >> >> - James >> >> >> >> On 1 May 2014 20:06, Divyansh Prakash <divyanshprakas...@gmail.com>wrote: >> >>> Hey! >>> I wrote a blog post discussing Thomson's Paradox, and simulated it in >>> Clojure- >>> http://pizzaforthought.blogspot.in/2014/05/and-infinity-beyond.html >>> >>> The *state* function defined towards the end is not very functional. >>> Could someone guide me towards a cleaner approach? >>> >>> Also, I can't find good code-highlighting tools for blogger/clojure. Any >>> suggestions? >>> >>> -- >>> 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. >>> >> >> -- >> 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. >> > > -- > 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. > -- 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.