I think (reduce + (range N)) is commonly used in **examples**, not 
necessarily in real applications.

-S


On Thursday, February 6, 2014 5:59:43 AM UTC-5, Jim foo.bar wrote:
>
> Hi all, 
>
> I often see this code for summing up a range from 0-N : `(reduce + 
> (range N))` 
>
> However there is a much faster way for this :   `(/ (* N (dec N)) 2)` 
>
> Do you think this should be in the language so that people do not use 
> the slow version? 
>
> Jim 
>

-- 
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/groups/opt_out.

Reply via email to