On Mar 8, 8:22 pm, Jonathan Shore <jonathan.sh...@gmail.com> wrote: > 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.
Shame? Isn't most of us here for Clojure's access to a vast amount of industrial strength Java libraries in the wild? In your case writing pure Clojure code can be an option, but in my case it really is easier (and effective) to make code reuse. OTOH, so mentioned native binaries don't have open source equivalents, hence I'm stucked to them. > 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. That's what I do at the moment, but support for multi-dimensional arrays would be more appropriate, IMHO. > 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? For instance, consider a matrix decomposition scheme where you need to keep the track of index mappings between transformations. In C/Java, I'd have lots of dummy objects/functions around, messy for loops, allocation/release stuff, etc. But in Lisp, map/reduce/filter family, lambdas, and some glue code via macros, etc. makes your code damn easy to read/maintain and introduce new features. Moreover, mutable data structures (I have thin gateway between Clojure vectors and native Java vectors) helps me to exploit code in a functional way, no need to worry for matrix index mangling problems. > 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). Just use the language you are most comfortable at. In my situation, access to foreign Java libraries, immutable data structures, Lisp inheritance (macros, lambdas, closures, etc.) dominates here. YMMV. 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