Yes, Clojure can be just as fast as Java. There's an example on the
Clojure website that illustrates this.

<snip>
http://clojure.org/java_interop

Rather than write this Java:

static public float asum(float[] xs){
  float ret = 0;
  for(int i = 0; i < xs.length; i++)
    ret += xs[i];
  return ret;
}

you can write this Clojure:

(defn asum [#^floats xs]
  (areduce xs i ret (float 0)
    (+ ret (aget xs i))))

and the resulting code is exactly the same speed (when run with java -
server).
</snip>

-Travis

On Aug 11, 4:02 pm, fft1976 <fft1...@gmail.com> wrote:
> On Aug 11, 12:02 pm, ataggart <alex.tagg...@gmail.com> wrote:
>
> > On Aug 11, 11:55 am, fft1976 <fft1...@gmail.com> wrote:
>
> > > I feel that this question is important enough to warrant its own
> > > thread.
>
> >http://groups.google.com/group/clojure/search?group=clojure&q=%22as+f...
>
> Sounds like you are saying that the consensus is "no", but I
> distinctly remember Rich saying "yes" in one of his videos. Has anyone
> seen all his videos recently who can confirm or deny this? It's been a
> while for me.
>
> Even if "no", then _why_? This isn't some functional Lispy code.
> Andy's code does exactly what Java's code does (except for using double
> [] in place of Java's classes with members of type double)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to