Re: maven-shade-plugin issues with Clojure core (or any clj) AOT compilation
I just tripped over this and opened https://issues.apache.org/jira/browse/MSHADE-272 . Affected users might like to vote it up. FWIW, my workaround: maven-shade-plugin ... *:* **/*.class **/*.properties clojure/core_instant18.clj -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
aot compilation: minimise the scope of the resulting classes
I'm using lein2 to aot compile a namespace than generates a Java "Bootstrap" class. Bootstrap implements an interface and delegates calls to other namespaces. For some reason, the resulting jar file includes compiled classes for the delegate namespaces, and many of their transitive dependencies. I tried to use jar-exclusions to remove the extra class files from the jar, but the graph of generated Java class appears to link to them as it fails at runtime with NoClassDefFoundExceptions. I'd like to compile the bare minimum, even if this means some sort of thunk in Bootstrap. How can I do this? Thanks for any pointers. - Phil -- 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
compile: produce a java class with minimum linkage to other clojrue code
Hello, I'm aot compiling a namespace with lein2 to produce a Java class that is (:gen-class :name blah.Bootstrap :implements [some.java.Interface] :prefix bootstrap- )) -- 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
Re: aot compilation: minimise the scope of the resulting classes
On Tuesday, May 22, 2012 6:06:21 PM UTC+1, Hugo Duncan wrote: > > Phil Hagelberg writes: > > One solution is to call require at runtime inside function bodies > > rather than at the top-level. Then to call the functions from the > > runtime-required namespace, use the resolve function. > > Another is to use :impl-ns option in genclass and implement the java class > in a separate > namespace (assuming you are using genclass). > > Thank you both for the rapid assistance. - Phil -- 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
[PATCH] Enhance clojure.data/diff to cope with falsey values in maps
Current behaviour of clojure.data/diff: => (diff {:a false} {:a true}) (nil {:a true} nil) => (diff {:a false} {:a nil}) (nil nil nil) With patch: => (diff {:a false} {:a true}) ({:a false} {:a true} nil) => (diff {:a false} {:a nil}) ({:a false} {:a nil} nil) This seems more consistent and useful to me, but I may be missing something. Should I open a JIRA? - Phil --- >From e03a8060214d122ea2ebadf9e8a368f7f593d9f4 Mon Sep 17 00:00:00 2001 From: Philip Aston Date: Sun, 10 Jun 2012 13:11:36 +0100 Subject: [PATCH] clojure.data/diff: cope with falsey values in maps --- src/clj/clojure/data.clj | 18 +- test/clojure/test_clojure/data.clj |3 ++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/clj/clojure/data.clj b/src/clj/clojure/data.clj index 6e8dbcf..345b234 100644 --- a/src/clj/clojure/data.clj +++ b/src/clj/clojure/data.clj @@ -30,6 +30,22 @@ (vec (repeat (apply max (keys m)) nil)) m))) +(defn- diff-associative-key + "Diff associative things a and b, comparing only the key k." + [a b k] + (let [va (get a k) +vb (get b k) +[a* b* ab] (diff va vb) +in-a (contains? a k) +in-b (contains? b k) +same (and in-a in-b + (or (not (nil? ab)) + (and (nil? va) (nil? vb] +[(when (and in-a (or (not (nil? a*)) (not same))) {k a*}) + (when (and in-b (or (not (nil? b*)) (not same))) {k b*}) + (when same {k ab}) + ])) + (defn- diff-associative "Diff associative things a and b, comparing only keys in ks." [a b ks] @@ -38,7 +54,7 @@ (doall (map merge diff1 diff2))) [nil nil nil] (map -(fn [k] (map #(when % {k %}) (diff (get a k) (get b k +(partial diff-associative-key a b) ks))) (defn- diff-sequential diff --git a/test/clojure/test_clojure/data.clj b/test/clojure/test_clojure/data.clj index 9bab766..5a241e0 100644 --- a/test/clojure/test_clojure/data.clj +++ b/test/clojure/test_clojure/data.clj @@ -27,5 +27,6 @@ [#{1} #{3} #{2}] (HashSet. [1 2]) (HashSet. [2 3]) [nil nil [1 2]] [1 2] (into-array [1 2]) [nil nil [1 2]] (into-array [1 2]) [1 2] - [{:a {:c [1]}} {:a {:c [0]}} {:a {:c [nil 2] :b 1}}] {:a {:b 1 :c [1 2]}} {:a {:b 1 :c [0 2]}})) + [{:a {:c [1]}} {:a {:c [0]}} {:a {:c [nil 2] :b 1}}] {:a {:b 1 :c [1 2]}} {:a {:b 1 :c [0 2]}} + [{:a nil} {:a false} {:b nil :c false}] {:a nil :b nil :c false} {:a false :b nil :c false})) -- 1.7.9.5 -- 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
Re: [PATCH] Enhance clojure.data/diff to cope with falsey values in maps
I've opened JIRA CLJ-1011. On Sunday, June 10, 2012 1:16:55 PM UTC+1, Philip Aston wrote: > > Current behaviour of clojure.data/diff: > > => (diff {:a false} {:a true}) > (nil {:a true} nil) > => (diff {:a false} {:a nil}) > (nil nil nil) > > With patch: > > => (diff {:a false} {:a true}) > ({:a false} {:a true} nil) > => (diff {:a false} {:a nil}) > ({:a false} {:a nil} nil) > > > This seems more consistent and useful to me, but I may be missing > something. > > Should I open a JIRA? > > - Phil > > > --- > > From e03a8060214d122ea2ebadf9e8a368f7f593d9f4 Mon Sep 17 00:00:00 2001 > From: Philip Aston > Date: Sun, 10 Jun 2012 13:11:36 +0100 > Subject: [PATCH] clojure.data/diff: cope with falsey values in maps > > --- > src/clj/clojure/data.clj | 18 +- > test/clojure/test_clojure/data.clj |3 ++- > 2 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/src/clj/clojure/data.clj b/src/clj/clojure/data.clj > index 6e8dbcf..345b234 100644 > --- a/src/clj/clojure/data.clj > +++ b/src/clj/clojure/data.clj > @@ -30,6 +30,22 @@ > (vec (repeat (apply max (keys m)) nil)) > m))) > > +(defn- diff-associative-key > + "Diff associative things a and b, comparing only the key k." > + [a b k] > + (let [va (get a k) > +vb (get b k) > +[a* b* ab] (diff va vb) > +in-a (contains? a k) > +in-b (contains? b k) > +same (and in-a in-b > + (or (not (nil? ab)) > + (and (nil? va) (nil? vb] > +[(when (and in-a (or (not (nil? a*)) (not same))) {k a*}) > + (when (and in-b (or (not (nil? b*)) (not same))) {k b*}) > + (when same {k ab}) > + ])) > + > (defn- diff-associative >"Diff associative things a and b, comparing only keys in ks." >[a b ks] > @@ -38,7 +54,7 @@ > (doall (map merge diff1 diff2))) > [nil nil nil] > (map > -(fn [k] (map #(when % {k %}) (diff (get a k) (get b k > +(partial diff-associative-key a b) > ks))) > > (defn- diff-sequential > diff --git a/test/clojure/test_clojure/data.clj > b/test/clojure/test_clojure/data.clj > index 9bab766..5a241e0 100644 > --- a/test/clojure/test_clojure/data.clj > +++ b/test/clojure/test_clojure/data.clj > @@ -27,5 +27,6 @@ > [#{1} #{3} #{2}] (HashSet. [1 2]) (HashSet. [2 3]) > [nil nil [1 2]] [1 2] (into-array [1 2]) > [nil nil [1 2]] (into-array [1 2]) [1 2] > - [{:a {:c [1]}} {:a {:c [0]}} {:a {:c [nil 2] :b 1}}] {:a {:b 1 :c > [1 2]}} {:a {:b 1 :c [0 2]}})) > + [{:a {:c [1]}} {:a {:c [0]}} {:a {:c [nil 2] :b 1}}] {:a {:b 1 :c > [1 2]}} {:a {:b 1 :c [0 2]}} > + [{:a nil} {:a false} {:b nil :c false}] {:a nil :b nil :c false} > {:a false :b nil :c false})) > > -- > 1.7.9.5 > > -- 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