On Mar 8, 2010, at 11:51 AM, Volkan YAZICI wrote: > On Mar 7, 6:35 pm, jshore <jonathan.sh...@gmail.com> wrote: >> Wondering whether anyone has done something very complex in the algo >> space or comparable so can get an idea of how this sort of stuff is >> structured idiomatically. I will also be concerned with performance >> and memory use, as one of my strategies creates a few thousand sub- >> strategies and/or also uses massive matrices that get updates from >> tick to tick. > > Recently, I have been using Clojure to implement a model we introduced > related with hypergraphs. For this purpose, most of the heavy work is > done in C libraries (JNA is quite easy to use) and pure Java libraries > (thanks to Java interop.), hence no problems so far. And Clojure
It is a shame to have to dive down to Java or native (perhaps with the exception of some of the massive numerical libraries one does not want to rewrite). I'm hoping to use Clojure or something like clojure as a complete replacement. On the .NET platform F# looks to have a performance profile that allows one to write exclusively in the F# variant of Ocaml. My issue is that I am not on a MS platform. > supplies a cool interface to pure Java arrays (int-array, float-array, > etc.) in a relatively reasonable way. But AFAIK, there is no way to > use multi-dimensional arrays (i.e. int[][]) asis in Clojure. (I might > be missing something about this, folks told that there are no real Well, I imagine one could at least write matrix-style access in terms of a single dim array (as is done in many languages). One could write a set of functions that work on a binding of an array with dimension. For the sake of understanding, I'm not yet clear on how one *efficiently* binds multiple "pieces" of state together in clojure. How would one create a simple matrix for example where I want to bind dimension and a float-array into a tightly bound structure. I can see that a assoc / map could be used (but has undesireable overhead) or perhaps a closure with the array, dimensions, and a returning function for access? > multi-dimensional arrays in Java either.) And it is a PITA to write > imperative code in Clojure, and most algorithms are written in an > imperative style. (You know, "for (i = k; i < c; i++) ..." loops > everywhere.) But it is not hard to implement a few utility macros for > yourself. (Hrm... A contrib library would be really awesome.) > Moreover, Clojure data structures and their J2SE suplements really > eases your work -- think all industrial quality set, list, priority > queue, etc. implementations. To sum up, I must admit that Clojure (or > more generally speaking, Lisp) stands as a quite effective tool to > bridge between algorithms. > Hmm, if it is to be a bridge, then could just as well consider jruby. jruby has many of the lisp constructs and conveniences. In fact there is now a ruby subset called Duby which provides java-level performance by doing type inference (or by using type annotations). Thanks for you observations. Has been very useful. > Regards. > > -- > 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 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