If you follow me on Twitter, you'll have seen me posting about Clojure quite a bit recently. I really like the simplicity and elegance of Clojure. I like the function programming style. I like that it's a dynamic scripting language. I like that it can also be compiled to JVM bytecode and used in any mixed-language project on the JVM.
About a month ago I helped someone get some Clojure code compiled and integrated into CFML, like any other Java-based project, but that set me thinking about being able to just use raw Clojure scripts from CFML without needing to go thru the compilation and deployment process. I asked on the Clojure mailing list how to load and run scripts from Java and that gave me what I needed to create a simple CFC wrapper that lets you write Clojure scripts and dynamically load and execute them from inside CFML.
That's how cfmljure was born on github! It's very early days for the project - I consider this an 'experimental' version - but I've created a Google mailing list for cfmljure and it's also listed on RIAForge). I don't expect it to be crazy popular (like FW/1 for example) but I expect to use it on production projects and thought it would be good to put out there for others to experiment with and provide feedback on.
Things on the roadmap include making it more Leiningen friendly (Leiningen is the de facto standard build tool for Clojure and it definitely makes life simpler) as well as figuring out how to access Clojure variables from CFML. I may even try to figure out how to pass CFCs into Clojure and have them be callable (Clojure can call Java but I'll probably go the route of a Clojure proxy function initially).
Have fun with it! Join the Google Group if you have questions / problems / suggestions!

5 responses so far ↓
1 TJ Downes // Sep 3, 2010 at 8:39 AM
2 Dan Vega // Sep 3, 2010 at 9:57 AM
3 Sean Corfield // Sep 3, 2010 at 12:47 PM
Functional languages are really good at working with collections of data, composing and applying small pieces of logic to implement complex processes on homogenous data sets. With the inherent immutability and potential for parallelism, this offers a safer and, on multi-core systems, potentially much faster way to process data.
4 Dan Vega // Sep 3, 2010 at 1:18 PM
5 Sean Corfield // Sep 3, 2010 at 4:36 PM
For example, I'm using Scala with CFML right now to implement some heavy lifting with XML where CFML just can't match the performance needed. Scala's "actors" let me do safe concurrency and XML is a native data type - I get somewhere between 10x and 20x improvement with Scala over CFML for this problem. But I wouldn't want to write all my backend in Scala.
Same with Clojure: I can see using it for specific data manipulation tasks where the equivalent CFML might be too complex or too slow (or both).
Leave a Comment