Sean wrote: > I'm working with AWT, and there is a method that requires a float[] > (The java.awt.BasicStroke constructor). Is it possible to directly > create an array of primitives directly in Clojure, or do I need to > create a utility class in Java? >
See: (doc make-array) (doc into-array) For example, the java equivalent of: float[] my_array = new float[100]; (def my-array (make-array Float/TYPE 100)) A very silly example, to fill in the array. ; Fill the native array: (dotimes [i (count my-array)] (aset my-array i (float i))) Then you may want to iterate it using a shallow 'vec' wrapper to iterate the array: ; Print its values: (doseq [v (vec my-array)] (println v)) Albert -- Albert Cardona http://albert.rierol.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---