> Aside from the misuse of 'for' (which then needs to be iterated to
> cause the side-effects), what am I missing here? Hints on idiomatic
> Clojure as well as my primitives question are most welcome.
Have you tried float-array?
Examples:
user=> (class (float-array 1))
[F
user=> (aget (float-a
> Did you try (into-array Float/TYPE [(float 1.0) (float 2.0)])? I'm not
> sure it works, though. I haven't much done with primitives up to now.
Aha. It does work. The key bit of information being that there was
another way to call into-array (which I actually speculated about
being a good additio
On Mon, Apr 19, 2010 at 6:29 PM, Meikel Brandmeyer wrote:
> PS: Tested with 1.0, though. So maybe this changed to 1.1.
No, even in HEAD there is only support for reading doubles. It would
be nice if the reader supported the customary 'f' suffix for reading
floats. I actually made that change loca
Hi,
On Apr 19, 1:22 pm, Jarkko Oranen wrote:
> You can just do (into-array Float/TYPE [1.0 2.0])
> There is no need to explicitly cast the vector items as they would be
> boxed anyway as vectors currently can't contain primitives.
Clojure just got mad on me without the casts: "argument type
mis
Hi,
On Apr 19, 12:17 pm, Joel Gluth wrote:
> (def floatarray (make-array Float/TYPE 2))
> (for [i (range (alength floatarray))] (aset floatarray i (float ([1 2]
> i
>
> Aside from the misuse of 'for' (which then needs to be iterated to
> cause the side-effects), what am I missing here? Hints
On Apr 19, 1:17 pm, Joel Gluth wrote:
> (def floatarray (make-array Float/TYPE 2))
> (for [i (range (alength floatarray))] (aset floatarray i (float ([1 2]
> i
You can just do (into-array Float/TYPE [1.0 2.0])
There is no need to explicitly cast the vector items as they would be
boxed anyway
Hi all,
(There is an old thread on a similar topic to this, but I seem to be
unable to reply to the group about it, only to the author).
I've been using Clojure this last week, and in general enjoying it
very much. There have been a small number of jarring moments though,
to do with Java interop,