3 ms·
Ah the memories. I attempted to integrate J-lang into Clojure at one point. Imagine doing (defn average [coll] (j +/ %#)) And have it run at the speed of C :
by lbj 7y ago
Ah the memories. I attempted to integrate J-lang into Clojure at one point.
Imagine doing
(defn average [coll] (j +/ %#))
And have it run at the speed of C :)
(I failed because I didnt have the patience to sort out all the type-casting)
- earenndil 7y ago> And have it run at the speed of c Unlikely; clojure runs on the jvm (or on top of js), and interop with c is slow.
- lbj 7y agoWell - Maybe you're right. I hope to find out some day
- gmfawcett 7y agoIf you're on the JVM, and if you're compiling J down to JVM bytecode (much as April compiles APL -> CL -> machine code), and if your data is stored in primitive Java arrays, then you'd get pretty close to C speeds. Or at least J speeds (where J is implemented in C). That's a lot of conditions, but it's not completely crazy. :)
- earenndil 7y agoMaybe. Java is quite fast, but for very different reasons than APL; I don't think it would transfer that easily. Part of the reason APLs are so fast is because the interpreter and all the code fit in cache; my copy of k is 76kb. I don't think there's a chance you could get that with the jvm. APL also relies heavily on SIMD, and I don't know how well-supported that is on the JVM.
- gmfawcett 7y agoGranted, those are fair points. My copy of J is 42KB, so I understand where you're coming from. :) There's some support for vectorization in the JVM, e.g. [1, 2], but I suspect it's hit-or-miss. [1] https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6340864 https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6340864 [2] https://bugs.java.com/bugdatabase/view_bug.do?bug_id=7192383 https://bugs.java.com/bugdatabase/view_bug.do?bug_id=7192383
- mamcx 7y agoI'm looking in integrate the array paradigms and the relational paradigm together in rust. Having a hard time looking in how surface iterators but the array part on my initial internal testing look great...