3 ms·
Some Java interop instructions are here: http://www.arclanguage.org/item?id=8819 http://www.arclanguage.org/item?id=8819 Arc runs on all platforms that MzSchem
by cchooper 18y ago
Some Java interop instructions are here: http://www.arclanguage.org/item?id=8819 http://www.arclanguage.org/item?id=8819
Arc runs on all platforms that MzScheme runs on, which includes Windows.
- herdrick 18y agoAh, so apparently PG didn't go with the unix integration he mentioned once. Your Java interop looks good, yet the code is a bit more verbose than the equivalent in Java. Also, can Arc lists and hashes be used as Java List and Map collections?
- conanite 18y agorainbow converts arc lists and hashes to and from java List and Map equivalents. rainbow also uses 'defcall from anarki so you don't ever have to call java-invoke: you can put your java-object in functional position, followed by the method name, followed by the arguments. For example, (my-object 'hashCode) is the equivalent of java's myObject.hashCode(); ... essentially the same number of tokens. I expect to wrap the most popular java libraries behind arc-sounding macros/functions. rainbow comes with a tetris and a simple arc editor called welder, they both use java's Swing library, take a look if you'd like to see an example of this kind of wrapping. Or try http://www.fnargs.com/2009/01/calling-java-from-arc.html http://www.fnargs.com/2009/01/calling-java-from-arc.html I think "official arc" still assumes a unix for some functions ... I don't know what PG's final position on this is.
- herdrick 18y agoApologies for the days of delay - I'm on a reduced HN diet. So, in Clojure you can't use Java objects with the great sequence and hashmap libs: (def h (new java.util.HashMap)) (. h put :a 1) (. h put :b 2) user=> h #=(java.util.HashMap. {:b 2, :a 1}) Hashmaps in Clojure are, like Arc's, callable: user=> ({:a 1 :b 2} :b) 2 But not if they are Java Maps: user=> (h :b) java.lang.ClassCastException: java.util.HashMap (NO_SOURCE_FILE:0) So rainbow does the right thing - let's you use Arc functions on Java objects? By the way, Clojure's .. macro is pretty handy: (.. System (getProperties) (get "os.name")) expands to: (. (. System (getProperties)) (get "os.name"))