On Jan 3, 12:20 pm, "Mark Volkmann" <r.mark.volkm...@gmail.com> wrote: > One of the stated benefits of functional programming I've seen is that > the compiler of a functional language can analyze code and determine > statements within a function that can safely be run concurrently. As > far as I know Clojure doesn't yet do this. Correct?
Clojure does not automatically exploit thread parallelism for performance. However, the JVM implementation quite probably exploits instruction-level parallelism and may also have a parallel and/or concurrent garbage collector. (Parallel CG means exploiting parallelism to make the GC itself run faster; concurrent GC means a garbage collection doesn't "stop the world.") > Which functional programming languages, if any, do this? SISAL and NESL are the two most prominent examples in my mind. The reason why not a lot of functional programming languages did this was because previously, "parallel" was something only HPC folks worried about, and HPC folks didn't want to switch to functional languages for various reasons, partly cultural and partly practical. (SISAL was one attempt to get them to switch and it didn't work, despite its compiler being fairly successful at automatic parallelization.) Now your laptop is parallel because of the Power Wall and ordinary mortal coders are being asked to write parallel code. (The best HPC coders are the sort that can find bottlenecks by passing their hand over the CPU die and grokking where the bits go.) It's enough of a paradigm shift and the number of affected programmers is large enough that people are considering new programming language solutions. Remember that "parallel" and "concurrent" are two different things. "Concurrent" is something you deal with all the time if you are writing GUI apps: there are different threads and they interact in some possibly unpredictable way. You can have concurrency on a single- core machine. "Parallel" means multiple CPUs working together for _performance_, i.e., to run faster. Clojure has a lot of tools to solve concurrency problems. I think of it as a language designed for that goal. There are also tools in Clojure (like pmap) to exploit parallelism, but the concurrency tools are more developed. mfh --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---