On Mon, Dec 6, 2010 at 11:45 AM, Konrad Hinsen <konrad.hin...@fastmail.net> wrote: > On 06.12.2010, at 16:02, Johann Hibschman wrote: >> Maybe I'm not reading the right news, but I've not seen all that much on >> using Java for scientific work for a while now. The NIST JavaNumerics >> guys seem to have given up, but if I remember correctly their >> conclusions were that Java really needed complex numbers as a >> value/stack-allocated type. > > I'd say what Java needs is not complex numbers as a value type, but a way to > define additional value types. Complex numbers are just one applications. > Another one is points (2D or 3D) for geometry and graphics. > > Unfortunately the problem is not just Java, but the JVM, meaning that Clojure > inherits the problem.
Clojure does not inherit the problem, if you use macros cleverly. You can stack allocate individual primitives, separately, e.g. (let [x (int 3) y (double 4.2)] ...) And with macros you can wrap that in an abstraction that looks like a single object, such as a point or a complex number. Passing it to a function would require a bit of magic, though -- say, bundling the components into a vector and passing that as the fn arg, and unbundling again on the inside. If the call gets inlined the JIT should hopefully be able to optimize away this boxing. -- 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