The parallel library wraps the ForkJoin library scheduled for
inclusion in JDK 7:
http://gee.cs.oswego.edu/dl/concurrency-interest/index.html
You'll need jsr166y.jar in your classpath in order to use this
library.
(use '(clojure.parallel))
(clojure.parallel/preduce * (range 2 16))

On Jul 26, 6:40 am, atucker <agjf.tuc...@googlemail.com> wrote:
> I wonder if any of the Clojurians on here might like to describe how
> one might write the factorial function as a parallel one?  Taking
> advantage of the associativity of multiplication, along the lines of
>
> 16! = (((1*2)*(3*4)) * ((5*6)*(7*8))) * (((9*10)*(11*12)) * ((13*14)*
> (15*16)))

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to