Re: How can find something inside heavily nested data structure ?

2015-08-22 Thread henrik42
I like using tree-seq and core.match when working on instaparse ASTs - like 
this:

(require ['clojure.core.match :as 'm])

(def s
  [{"n" {"id" "a"} "d" 2 "children" [{"n" {"id" "c"} "d" 4 "children" 
nil}]} {"n" {"id" "b"} "d" 3 "children" nil}])

;; top-down-traversal
(defn nodes [x]
  (tree-seq coll? seq x))

;; target pred
(defn sel-pred [n]
  (and (map? n)
   (some
#{{"id" "c"}}
(vals n
(some
 (fn [x]
   (m/match x
(_ :guard #(sel-pred %)) x 
:else nil))
 (tree-seq coll? seq s))

The guard is a little clumbsy but as far as I can see match does not 
support map-matches with binding-keys like {k {"id" "c"}}.

-- 
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.


Re: when the body of the request is HttpInputOverHTTP, how do I get the string representation?

2015-08-22 Thread Nathaniel Young
FWIW DuckDuckGo is very good for searching software terms. The Jetty Docs were 
the second hit for me: https://duckduckgo.com/?q=HttpInputOverHTTP



> On Aug 19, 2015, at 3:57 PM, Lawrence Krubner  
> wrote:
> 
> I know this has been asked before, but Google is interpreting 
> "HttpInputOverHTTP" as "Http Input Over HTTP" which renders it useless for 
> finding conversations that are specific to the HttpInputOverHTTP class. (off 
> topic: I wish there was a good search engine for software terms).
> 
> I've a simple web app using Jetty and Ring and Compojure. The body of each 
> request that comes in is: 
> 
> :body #
> 
> If I do: 
> 
> (str (:body request))
> 
> I simply get:
> 
> HttpInputOverHTTP@3aa0a4ac
> 
> Can someone remind how I get a string representation of what should be in the 
> body? 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> 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.

-- 
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.


Cursive and gen-class

2015-08-22 Thread William la Forge
I searched and did not see anything recent on gen-class problems in 
Cursive. I find when I have a reference to a gen-class instance that 
instance? works in Cursive but .getClass does not. (Everything works with 
lein, of course.)

What I am trying to do is to call the count method via (.count x). What I 
do not want to do is call the clojure count function, (count x). Again, no 
issues with lein. 

I suspect I simply have not completed the setup cursive for compiles or 
something, as all the complaints about cursive/gen-class that I could find 
were a year old.

I know I need to switch to emacs at some times. I mean, it's only been 30 
years since I used it last. :D

Here's the error I'm getting:

Exception in thread "main" java.lang.NoClassDefFoundError: 
java/util/function/UnaryOperator, 
compiling:(C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj:22:10)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6730)
at clojure.lang.Compiler.analyze(Compiler.java:6524)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
at clojure.lang.Compiler.analyze(Compiler.java:6524)
at clojure.lang.Compiler.analyze(Compiler.java:6485)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
at clojure.lang.Compiler.analyze(Compiler.java:6524)
at clojure.lang.Compiler.analyze(Compiler.java:6485)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6179)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6723)
at clojure.lang.Compiler.analyze(Compiler.java:6524)
at clojure.lang.Compiler.analyze(Compiler.java:6485)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
at clojure.lang.Compiler.analyze(Compiler.java:6524)
at clojure.lang.Compiler.eval(Compiler.java:6779)
at clojure.lang.Compiler.load(Compiler.java:7227)
at clojure.lang.Compiler.loadFile(Compiler.java:7165)
at clojure.main$load_script.invoke(main.clj:275)
at clojure.main$script_opt.invoke(main.clj:337)
at clojure.main$main.doInvoke(main.clj:421)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:379)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

-- 
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.


Re: Cursive and gen-class

2015-08-22 Thread Colin Fleming
Hi William,

Right, you'll need to tell Cursive to compile that namespace in
*Settings->Build,
Execution, Deployment->Compiler->Clojure Compiler*. Once you've done that
things should work. Cursive doesn't currently pick the set of namespaces to
be compiled up from lein - it probably should.

Cheers,
Colin

On 22 August 2015 at 17:17, William la Forge  wrote:

> I searched and did not see anything recent on gen-class problems in
> Cursive. I find when I have a reference to a gen-class instance that
> instance? works in Cursive but .getClass does not. (Everything works with
> lein, of course.)
>
> What I am trying to do is to call the count method via (.count x). What I
> do not want to do is call the clojure count function, (count x). Again, no
> issues with lein.
>
> I suspect I simply have not completed the setup cursive for compiles or
> something, as all the complaints about cursive/gen-class that I could find
> were a year old.
>
> I know I need to switch to emacs at some times. I mean, it's only been 30
> years since I used it last. :D
>
> Here's the error I'm getting:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> java/util/function/UnaryOperator,
> compiling:(C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj:22:10)
> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6730)
> at clojure.lang.Compiler.analyze(Compiler.java:6524)
> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
> at clojure.lang.Compiler.analyze(Compiler.java:6524)
> at clojure.lang.Compiler.analyze(Compiler.java:6485)
> at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
> at clojure.lang.Compiler.analyze(Compiler.java:6524)
> at clojure.lang.Compiler.analyze(Compiler.java:6485)
> at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
> at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6179)
> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6723)
> at clojure.lang.Compiler.analyze(Compiler.java:6524)
> at clojure.lang.Compiler.analyze(Compiler.java:6485)
> at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
> at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
> at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
> at clojure.lang.Compiler.analyze(Compiler.java:6524)
> at clojure.lang.Compiler.eval(Compiler.java:6779)
> at clojure.lang.Compiler.load(Compiler.java:7227)
> at clojure.lang.Compiler.loadFile(Compiler.java:7165)
> at clojure.main$load_script.invoke(main.clj:275)
> at clojure.main$script_opt.invoke(main.clj:337)
> at clojure.main$main.doInvoke(main.clj:421)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at clojure.lang.Var.invoke(Var.java:379)
> at clojure.lang.AFn.applyToHelper(AFn.java:154)
> at clojure.lang.Var.applyTo(Var.java:700)
> at clojure.main.main(main.java:37)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
>
> --
> 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.
>

-- 
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.


Re: Cursive and gen-class

2015-08-22 Thread William la Forge
Hi Colin!

I've set it up to compile all. No doubt this will be very helpful as I will 
no longer need to compile using an external `lein compile`. But run still 
dies on the call (.getClass x), when x is a gen-class compiled class 
instance.

On the other hand I still can not credit this as a Cursive bug. Calling 
methods on gen-class compiled class instances is to basic. But it is likely 
related to Cursive, as 'lein test' works great.

On Saturday, August 22, 2015 at 4:24:40 PM UTC-4, Colin Fleming wrote:
>
> Hi William,
>
> Right, you'll need to tell Cursive to compile that namespace in 
> *Settings->Build, 
> Execution, Deployment->Compiler->Clojure Compiler*. Once you've done that 
> things should work. Cursive doesn't currently pick the set of namespaces to 
> be compiled up from lein - it probably should.
>
> Cheers,
> Colin
>
> On 22 August 2015 at 17:17, William la Forge  > wrote:
>
>> I searched and did not see anything recent on gen-class problems in 
>> Cursive. I find when I have a reference to a gen-class instance that 
>> instance? works in Cursive but .getClass does not. (Everything works with 
>> lein, of course.)
>>
>> What I am trying to do is to call the count method via (.count x). What I 
>> do not want to do is call the clojure count function, (count x). Again, no 
>> issues with lein. 
>>
>> I suspect I simply have not completed the setup cursive for compiles or 
>> something, as all the complaints about cursive/gen-class that I could find 
>> were a year old.
>>
>> I know I need to switch to emacs at some times. I mean, it's only been 30 
>> years since I used it last. :D
>>
>> Here's the error I'm getting:
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError: 
>> java/util/function/UnaryOperator, 
>> compiling:(C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj:22:10)
>> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6730)
>> at clojure.lang.Compiler.analyze(Compiler.java:6524)
>> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
>> at clojure.lang.Compiler.analyze(Compiler.java:6524)
>> at clojure.lang.Compiler.analyze(Compiler.java:6485)
>> at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
>> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
>> at clojure.lang.Compiler.analyze(Compiler.java:6524)
>> at clojure.lang.Compiler.analyze(Compiler.java:6485)
>> at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
>> at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6179)
>> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6723)
>> at clojure.lang.Compiler.analyze(Compiler.java:6524)
>> at clojure.lang.Compiler.analyze(Compiler.java:6485)
>> at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
>> at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
>> at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
>> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
>> at clojure.lang.Compiler.analyze(Compiler.java:6524)
>> at clojure.lang.Compiler.eval(Compiler.java:6779)
>> at clojure.lang.Compiler.load(Compiler.java:7227)
>> at clojure.lang.Compiler.loadFile(Compiler.java:7165)
>> at clojure.main$load_script.invoke(main.clj:275)
>> at clojure.main$script_opt.invoke(main.clj:337)
>> at clojure.main$main.doInvoke(main.clj:421)
>> at clojure.lang.RestFn.invoke(RestFn.java:408)
>> at clojure.lang.Var.invoke(Var.java:379)
>> at clojure.lang.AFn.applyToHelper(AFn.java:154)
>> at clojure.lang.Var.applyTo(Var.java:700)
>> at clojure.main.main(main.java:37)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at 
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> at 
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:606)
>> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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...@google

Re: Cursive and gen-class

2015-08-22 Thread William la Forge
More weirdness. This works:

(let [^Object aa (.seq a5)]
  (println (.getClass aa)))


But not this:


(let [^AASetSequence aa (.seq a5)]
  (println (.getClass aa


Nor, of course, this:


(let [^AASetSequence aa (.seq a5)]
  (println (.count aa)))


Here's the error I'm getting now:


Information:8/22/2015 5:45 PM - Compilation completed with 1 error and 0 
warnings in 2s 743ms
C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj
Error:(26, 12) clojure: java.lang.NoClassDefFoundError: 
java/util/function/UnaryOperator, 
compiling:(aa_collections/immutable_set_test.clj:26:12)
java.lang.ClassNotFoundException: java.util.function.UnaryOperator
 at java.net.URLClassLoader$1.run (URLClassLoader.java:366)
java.net.URLClassLoader$1.run (URLClassLoader.java:355)
java.security.AccessController.doPrivileged (AccessController.java:-2)
java.net.URLClassLoader.findClass (URLClassLoader.java:354)
java.lang.ClassLoader.loadClass (ClassLoader.java:425)
java.lang.ClassLoader.loadClass (ClassLoader.java:358)
java.lang.Class.getDeclaredMethods0 (Class.java:-2)
java.lang.Class.privateGetDeclaredMethods (Class.java:2570)
java.lang.Class.privateGetPublicMethods (Class.java:2690)
java.lang.Class.getMethods (Class.java:1467)



On Saturday, August 22, 2015 at 5:37:13 PM UTC-4, William la Forge wrote:
>
> Hi Colin!
>
> I've set it up to compile all. No doubt this will be very helpful as I 
> will no longer need to compile using an external `lein compile`. But run 
> still dies on the call (.getClass x), when x is a gen-class compiled class 
> instance.
>
> On the other hand I still can not credit this as a Cursive bug. Calling 
> methods on gen-class compiled class instances is to basic. But it is likely 
> related to Cursive, as 'lein test' works great.
>
> On Saturday, August 22, 2015 at 4:24:40 PM UTC-4, Colin Fleming wrote:
>>
>> Hi William,
>>
>> Right, you'll need to tell Cursive to compile that namespace in 
>> *Settings->Build, 
>> Execution, Deployment->Compiler->Clojure Compiler*. Once you've done 
>> that things should work. Cursive doesn't currently pick the set of 
>> namespaces to be compiled up from lein - it probably should.
>>
>> Cheers,
>> Colin
>>
>> On 22 August 2015 at 17:17, William la Forge  wrote:
>>
>>> I searched and did not see anything recent on gen-class problems in 
>>> Cursive. I find when I have a reference to a gen-class instance that 
>>> instance? works in Cursive but .getClass does not. (Everything works with 
>>> lein, of course.)
>>>
>>> What I am trying to do is to call the count method via (.count x). What 
>>> I do not want to do is call the clojure count function, (count x). Again, 
>>> no issues with lein. 
>>>
>>> I suspect I simply have not completed the setup cursive for compiles or 
>>> something, as all the complaints about cursive/gen-class that I could find 
>>> were a year old.
>>>
>>> I know I need to switch to emacs at some times. I mean, it's only been 
>>> 30 years since I used it last. :D
>>>
>>> Here's the error I'm getting:
>>>
>>> Exception in thread "main" java.lang.NoClassDefFoundError: 
>>> java/util/function/UnaryOperator, 
>>> compiling:(C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj:22:10)
>>> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6730)
>>> at clojure.lang.Compiler.analyze(Compiler.java:6524)
>>> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
>>> at clojure.lang.Compiler.analyze(Compiler.java:6524)
>>> at clojure.lang.Compiler.analyze(Compiler.java:6485)
>>> at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
>>> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
>>> at clojure.lang.Compiler.analyze(Compiler.java:6524)
>>> at clojure.lang.Compiler.analyze(Compiler.java:6485)
>>> at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
>>> at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6179)
>>> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6723)
>>> at clojure.lang.Compiler.analyze(Compiler.java:6524)
>>> at clojure.lang.Compiler.analyze(Compiler.java:6485)
>>> at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
>>> at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
>>> at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
>>> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
>>> at clojure.lang.Compiler.analyze(Compiler.java:6524)
>>> at clojure.lang.Compiler.eval(Compiler.java:6779)
>>> at clojure.lang.Compiler.load(Compiler.java:7227)
>>> at clojure.lang.Compiler.loadFile(Compiler.java:7165)
>>> at clojure.main$load_script.invoke(main.clj:275)
>>> at clojure.main$script_opt.invoke(main.clj:337)
>>> at clojure.main$main.doInvoke(main.clj:421)
>>> at clojure.lang.RestFn.invoke(RestFn.java:408)
>>> at clojure.lang.Var.invoke(Var.java:379)
>>> at clojure.lang.AFn.applyToHelper(AFn.java:154)
>>> at clojure.lang.Var.applyTo(Var.java:700)
>>> at clojure.main.

Re: Cursive and gen-class

2015-08-22 Thread William la Forge
Bingo! Everything works when I revert to clojure 1.6.0.

On Saturday, August 22, 2015 at 5:49:24 PM UTC-4, William la Forge wrote:
>
> More weirdness. This works:
>
> (let [^Object aa (.seq a5)]
>   (println (.getClass aa)))
>
>
> But not this:
>
>
> (let [^AASetSequence aa (.seq a5)]
>   (println (.getClass aa
>
>
> Nor, of course, this:
>
>
> (let [^AASetSequence aa (.seq a5)]
>   (println (.count aa)))
>
>
> Here's the error I'm getting now:
>
>
> Information:8/22/2015 5:45 PM - Compilation completed with 1 error and 0 
> warnings in 2s 743ms
> C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj
> Error:(26, 12) clojure: java.lang.NoClassDefFoundError: 
> java/util/function/UnaryOperator, 
> compiling:(aa_collections/immutable_set_test.clj:26:12)
> java.lang.ClassNotFoundException: java.util.function.UnaryOperator
>  at java.net.URLClassLoader$1.run (URLClassLoader.java:366)
> java.net.URLClassLoader$1.run (URLClassLoader.java:355)
> java.security.AccessController.doPrivileged (AccessController.java:-2)
> java.net.URLClassLoader.findClass (URLClassLoader.java:354)
> java.lang.ClassLoader.loadClass (ClassLoader.java:425)
> java.lang.ClassLoader.loadClass (ClassLoader.java:358)
> java.lang.Class.getDeclaredMethods0 (Class.java:-2)
> java.lang.Class.privateGetDeclaredMethods (Class.java:2570)
> java.lang.Class.privateGetPublicMethods (Class.java:2690)
> java.lang.Class.getMethods (Class.java:1467)
>
>
>
> On Saturday, August 22, 2015 at 5:37:13 PM UTC-4, William la Forge wrote:
>>
>> Hi Colin!
>>
>> I've set it up to compile all. No doubt this will be very helpful as I 
>> will no longer need to compile using an external `lein compile`. But run 
>> still dies on the call (.getClass x), when x is a gen-class compiled class 
>> instance.
>>
>> On the other hand I still can not credit this as a Cursive bug. Calling 
>> methods on gen-class compiled class instances is to basic. But it is likely 
>> related to Cursive, as 'lein test' works great.
>>
>> On Saturday, August 22, 2015 at 4:24:40 PM UTC-4, Colin Fleming wrote:
>>>
>>> Hi William,
>>>
>>> Right, you'll need to tell Cursive to compile that namespace in 
>>> *Settings->Build, 
>>> Execution, Deployment->Compiler->Clojure Compiler*. Once you've done 
>>> that things should work. Cursive doesn't currently pick the set of 
>>> namespaces to be compiled up from lein - it probably should.
>>>
>>> Cheers,
>>> Colin
>>>
>>> On 22 August 2015 at 17:17, William la Forge  wrote:
>>>
 I searched and did not see anything recent on gen-class problems in 
 Cursive. I find when I have a reference to a gen-class instance that 
 instance? works in Cursive but .getClass does not. (Everything works with 
 lein, of course.)

 What I am trying to do is to call the count method via (.count x). What 
 I do not want to do is call the clojure count function, (count x). Again, 
 no issues with lein. 

 I suspect I simply have not completed the setup cursive for compiles or 
 something, as all the complaints about cursive/gen-class that I could find 
 were a year old.

 I know I need to switch to emacs at some times. I mean, it's only been 
 30 years since I used it last. :D

 Here's the error I'm getting:

 Exception in thread "main" java.lang.NoClassDefFoundError: 
 java/util/function/UnaryOperator, 
 compiling:(C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj:22:10)
 at clojure.lang.Compiler.analyzeSeq(Compiler.java:6730)
 at clojure.lang.Compiler.analyze(Compiler.java:6524)
 at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
 at clojure.lang.Compiler.analyze(Compiler.java:6524)
 at clojure.lang.Compiler.analyze(Compiler.java:6485)
 at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
 at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
 at clojure.lang.Compiler.analyze(Compiler.java:6524)
 at clojure.lang.Compiler.analyze(Compiler.java:6485)
 at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
 at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6179)
 at clojure.lang.Compiler.analyzeSeq(Compiler.java:6723)
 at clojure.lang.Compiler.analyze(Compiler.java:6524)
 at clojure.lang.Compiler.analyze(Compiler.java:6485)
 at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
 at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
 at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
 at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
 at clojure.lang.Compiler.analyze(Compiler.java:6524)
 at clojure.lang.Compiler.eval(Compiler.java:6779)
 at clojure.lang.Compiler.load(Compiler.java:7227)
 at clojure.lang.Compiler.loadFile(Compiler.java:7165)
 at clojure.main$load_script.invoke(main.clj:275)
 at clojure.main$script_opt.invoke

Re: Cursive and gen-class

2015-08-22 Thread Colin Fleming
That's very strange. I'd need more detailed instructions to try to
reproduce this. But the class it can't find is new in Java 8 so it looks
like you have a JVM version issue. I suspect that this shows up in Cursive
but not in lein because you're using a different JDK version in your
Cursive project than the one that is picked up on the command line.

I'm guessing that java -version on the command line will show Java 8, but
the one you have configured in your Cursive project (File->Project
Structure->Project->Project SDK and File->Project Structure->Modules->(your
module)->Module SDK) is less than that. Is that the case?

On 22 August 2015 at 23:58, William la Forge  wrote:

> Bingo! Everything works when I revert to clojure 1.6.0.
>
>
> On Saturday, August 22, 2015 at 5:49:24 PM UTC-4, William la Forge wrote:
>>
>> More weirdness. This works:
>>
>> (let [^Object aa (.seq a5)]
>>   (println (.getClass aa)))
>>
>>
>> But not this:
>>
>>
>> (let [^AASetSequence aa (.seq a5)]
>>   (println (.getClass aa
>>
>>
>> Nor, of course, this:
>>
>>
>> (let [^AASetSequence aa (.seq a5)]
>>   (println (.count aa)))
>>
>>
>> Here's the error I'm getting now:
>>
>>
>> Information:8/22/2015 5:45 PM - Compilation completed with 1 error and 0 
>> warnings in 2s 743ms
>> C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj
>> Error:(26, 12) clojure: java.lang.NoClassDefFoundError: 
>> java/util/function/UnaryOperator, 
>> compiling:(aa_collections/immutable_set_test.clj:26:12)
>> java.lang.ClassNotFoundException: java.util.function.UnaryOperator
>>  at java.net.URLClassLoader$1.run (URLClassLoader.java:366)
>> java.net.URLClassLoader$1.run (URLClassLoader.java:355)
>> java.security.AccessController.doPrivileged (AccessController.java:-2)
>> java.net.URLClassLoader.findClass (URLClassLoader.java:354)
>> java.lang.ClassLoader.loadClass (ClassLoader.java:425)
>> java.lang.ClassLoader.loadClass (ClassLoader.java:358)
>> java.lang.Class.getDeclaredMethods0 (Class.java:-2)
>> java.lang.Class.privateGetDeclaredMethods (Class.java:2570)
>> java.lang.Class.privateGetPublicMethods (Class.java:2690)
>> java.lang.Class.getMethods (Class.java:1467)
>>
>>
>>
>> On Saturday, August 22, 2015 at 5:37:13 PM UTC-4, William la Forge wrote:
>>>
>>> Hi Colin!
>>>
>>> I've set it up to compile all. No doubt this will be very helpful as I
>>> will no longer need to compile using an external `lein compile`. But run
>>> still dies on the call (.getClass x), when x is a gen-class compiled class
>>> instance.
>>>
>>> On the other hand I still can not credit this as a Cursive bug. Calling
>>> methods on gen-class compiled class instances is to basic. But it is likely
>>> related to Cursive, as 'lein test' works great.
>>>
>>> On Saturday, August 22, 2015 at 4:24:40 PM UTC-4, Colin Fleming wrote:

 Hi William,

 Right, you'll need to tell Cursive to compile that namespace in 
 *Settings->Build,
 Execution, Deployment->Compiler->Clojure Compiler*. Once you've done
 that things should work. Cursive doesn't currently pick the set of
 namespaces to be compiled up from lein - it probably should.

 Cheers,
 Colin

 On 22 August 2015 at 17:17, William la Forge  wrote:

> I searched and did not see anything recent on gen-class problems in
> Cursive. I find when I have a reference to a gen-class instance that
> instance? works in Cursive but .getClass does not. (Everything works with
> lein, of course.)
>
> What I am trying to do is to call the count method via (.count x).
> What I do not want to do is call the clojure count function, (count x).
> Again, no issues with lein.
>
> I suspect I simply have not completed the setup cursive for compiles
> or something, as all the complaints about cursive/gen-class that I could
> find were a year old.
>
> I know I need to switch to emacs at some times. I mean, it's only been
> 30 years since I used it last. :D
>
> Here's the error I'm getting:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> java/util/function/UnaryOperator,
> compiling:(C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj:22:10)
> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6730)
> at clojure.lang.Compiler.analyze(Compiler.java:6524)
> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
> at clojure.lang.Compiler.analyze(Compiler.java:6524)
> at clojure.lang.Compiler.analyze(Compiler.java:6485)
> at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
> at clojure.lang.Compiler.analyze(Compiler.java:6524)
> at clojure.lang.Compiler.analyze(Compiler.java:6485)
> at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
> at clojure.lang.Compiler$LetExpr$Parser.parse(Co

decoding clojure generated class names

2015-08-22 Thread Dave Tenny
I wanted to write a function like this:

(defn fn-name-info
  "Given a function, try to deduce the function name and clojure namespace 
by looking 
  at the function's java class name and decoding stuff.  Return a vector of 
name, namespace strings, 
  or nil if we can't find anything.
  
  For example, if in jdt.core we do (defn foo []), the resulting value foo 
is a thing whose class is
  jdt.core$foo, for which we can return [\"jdt.core\" \"foo\"].
  
  However, for anonymous functions like (fn []) typed into the REPL, 
  you're going to get something like [\"jdt.core\" \"eval3676$fn__3677\"]"
  [f]
  )

Surely someone out there has a bit of code that knows how to decode 
classnames accounting for
many of the weird edge cases, question marks (e.g. "QMARK"), and so on?

Can anybody help me out?

FYI, the next step I had planned for this was for me to reach take that fn 
information, look for the var that defines it, and yank out some metadata, 
when all I have is the function pointer, not the var.

Tips appreciated.

Yes, I know it's probably a bad idea for a couple of reasons, but feel free 
to point them out.


-- 
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.


Re: decoding clojure generated class names

2015-08-22 Thread Colin Fleming
Hi Dave,

All the various stacktrace-prettifying libraries (clj-stacktrace, Aviso
pretty etc) all do this - check their code out for some examples.

Cheers,
Colin

On 23 August 2015 at 01:07, Dave Tenny  wrote:

> I wanted to write a function like this:
>
> (defn fn-name-info
>   "Given a function, try to deduce the function name and clojure namespace
> by looking
>   at the function's java class name and decoding stuff.  Return a vector
> of name, namespace strings,
>   or nil if we can't find anything.
>
>   For example, if in jdt.core we do (defn foo []), the resulting value foo
> is a thing whose class is
>   jdt.core$foo, for which we can return [\"jdt.core\" \"foo\"].
>
>   However, for anonymous functions like (fn []) typed into the REPL,
>   you're going to get something like [\"jdt.core\" \"eval3676$fn__3677\"]"
>   [f]
>   )
>
> Surely someone out there has a bit of code that knows how to decode
> classnames accounting for
> many of the weird edge cases, question marks (e.g. "QMARK"), and so on?
>
> Can anybody help me out?
>
> FYI, the next step I had planned for this was for me to reach take that fn
> information, look for the var that defines it, and yank out some metadata,
> when all I have is the function pointer, not the var.
>
> Tips appreciated.
>
> Yes, I know it's probably a bad idea for a couple of reasons, but feel
> free to point them out.
>
>
> --
> 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.
>

-- 
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.


decoding clojure generated class names

2015-08-22 Thread Alex Miller
There is a demunge function in clojure.lang.Compiler. It's not foolproof as the 
munging is not unambiguously reversible.

-- 
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.


Rabid wild animals in my clojure argument lists, code gets infected.

2015-08-22 Thread Dave Tenny
I sure wish Clojure would generate "IllegalArgumentException" in the 
following sample case:

(defn foo [a b & {:keys [c d]}] 1)
(foo 1 2 :e 5) ; blithely ignores :e 5

I understand that Clojure's destructuring things are very nice, and more 
powerful than Common Lisp's, and I like
that when I need it.

However I can't tell you how many times I've been bitten by this. Some 
simple typo or other other parameter name error on keyword arguments
with untended and way-too-long-to-debug consequences.

In my mind, on this subject, Common Lisp lambda lists got this right and 
Clojure gets a poor grade.
Something about being doomed to repeat history.  In Common Lisp, if you 
really wanted to allow other (arbitrary) keywords you'd
just use &allow-other-keys.  

Maybe clojure should only allow the above case to go un-complained-about if 
:as was specified for the map.

If there's some automatic enforcement I'm missing that comes with 'defn' 
please let me know, I'm still learning the language.

I've thought more that once about making a common lisp DEFUN statement that 
maps to DEFN but implements
lambda list semantics (including 'supplied-p' parameters).  I've just been 
too lazy to do it.  

It would also likely perform poorly after injecting the additional 
checks/rearrangements into the function on top of what Clojure has already 
done,
so I suppose it would have to be taken a step further so that it didn't 
generate DEFN expressions at all but was implemented at DEFN's level as 
a seperately named form.

Tips welcome.  Just thinking aloud.

- Dave

-- 
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.


Re: Cursive and gen-class

2015-08-22 Thread William la Forge
At the moment I am dead in the water. Uninstalled cursive and now I can't 
reinstall. Dies after downloading.

Using Java 1.7.0_65 in the IDE. Lein says:

Leiningen 2.5.2 on Java 1.8.0_31 Java HotSpot(TM) 64-Bit Server VM.

Going to try manually downloading cursive, if I can figure out how.

On Saturday, August 22, 2015 at 6:56:46 PM UTC-4, Colin Fleming wrote:
>
> That's very strange. I'd need more detailed instructions to try to 
> reproduce this. But the class it can't find is new in Java 8 so it looks 
> like you have a JVM version issue. I suspect that this shows up in Cursive 
> but not in lein because you're using a different JDK version in your 
> Cursive project than the one that is picked up on the command line. 
>
> I'm guessing that java -version on the command line will show Java 8, but 
> the one you have configured in your Cursive project (File->Project 
> Structure->Project->Project SDK and File->Project Structure->Modules->(your 
> module)->Module SDK) is less than that. Is that the case?
>
> On 22 August 2015 at 23:58, William la Forge  > wrote:
>
>> Bingo! Everything works when I revert to clojure 1.6.0.
>>
>>
>> On Saturday, August 22, 2015 at 5:49:24 PM UTC-4, William la Forge wrote:
>>>
>>> More weirdness. This works:
>>>
>>> (let [^Object aa (.seq a5)]
>>>   (println (.getClass aa)))
>>>
>>>
>>> But not this:
>>>
>>>
>>> (let [^AASetSequence aa (.seq a5)]
>>>   (println (.getClass aa
>>>
>>>
>>> Nor, of course, this:
>>>
>>>
>>> (let [^AASetSequence aa (.seq a5)]
>>>   (println (.count aa)))
>>>
>>>
>>> Here's the error I'm getting now:
>>>
>>>
>>> Information:8/22/2015 5:45 PM - Compilation completed with 1 error and 0 
>>> warnings in 2s 743ms
>>> C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj
>>> Error:(26, 12) clojure: java.lang.NoClassDefFoundError: 
>>> java/util/function/UnaryOperator, 
>>> compiling:(aa_collections/immutable_set_test.clj:26:12)
>>> java.lang.ClassNotFoundException: java.util.function.UnaryOperator
>>>  at java.net.URLClassLoader$1.run (URLClassLoader.java:366)
>>> java.net.URLClassLoader$1.run (URLClassLoader.java:355)
>>> java.security.AccessController.doPrivileged (AccessController.java:-2)
>>> java.net.URLClassLoader.findClass (URLClassLoader.java:354)
>>> java.lang.ClassLoader.loadClass (ClassLoader.java:425)
>>> java.lang.ClassLoader.loadClass (ClassLoader.java:358)
>>> java.lang.Class.getDeclaredMethods0 (Class.java:-2)
>>> java.lang.Class.privateGetDeclaredMethods (Class.java:2570)
>>> java.lang.Class.privateGetPublicMethods (Class.java:2690)
>>> java.lang.Class.getMethods (Class.java:1467)
>>>
>>>
>>>
>>> On Saturday, August 22, 2015 at 5:37:13 PM UTC-4, William la Forge wrote:

 Hi Colin!

 I've set it up to compile all. No doubt this will be very helpful as I 
 will no longer need to compile using an external `lein compile`. But run 
 still dies on the call (.getClass x), when x is a gen-class compiled class 
 instance.

 On the other hand I still can not credit this as a Cursive bug. Calling 
 methods on gen-class compiled class instances is to basic. But it is 
 likely 
 related to Cursive, as 'lein test' works great.

 On Saturday, August 22, 2015 at 4:24:40 PM UTC-4, Colin Fleming wrote:
>
> Hi William,
>
> Right, you'll need to tell Cursive to compile that namespace in 
> *Settings->Build, 
> Execution, Deployment->Compiler->Clojure Compiler*. Once you've done 
> that things should work. Cursive doesn't currently pick the set of 
> namespaces to be compiled up from lein - it probably should.
>
> Cheers,
> Colin
>
> On 22 August 2015 at 17:17, William la Forge  
> wrote:
>
>> I searched and did not see anything recent on gen-class problems in 
>> Cursive. I find when I have a reference to a gen-class instance that 
>> instance? works in Cursive but .getClass does not. (Everything works 
>> with 
>> lein, of course.)
>>
>> What I am trying to do is to call the count method via (.count x). 
>> What I do not want to do is call the clojure count function, (count x). 
>> Again, no issues with lein. 
>>
>> I suspect I simply have not completed the setup cursive for compiles 
>> or something, as all the complaints about cursive/gen-class that I could 
>> find were a year old.
>>
>> I know I need to switch to emacs at some times. I mean, it's only 
>> been 30 years since I used it last. :D
>>
>> Here's the error I'm getting:
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError: 
>> java/util/function/UnaryOperator, 
>> compiling:(C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj:22:10)
>> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6730)
>> at clojure.lang.Compiler.analyze(Compiler.java:6524)
>> at clojure

Re: Cursive and gen-class

2015-08-22 Thread William la Forge
lean version shows java 8, but the ide sdk is java7. Didn't know they would 
be connected. :0

On Saturday, August 22, 2015 at 6:56:46 PM UTC-4, Colin Fleming wrote:
>
> That's very strange. I'd need more detailed instructions to try to 
> reproduce this. But the class it can't find is new in Java 8 so it looks 
> like you have a JVM version issue. I suspect that this shows up in Cursive 
> but not in lein because you're using a different JDK version in your 
> Cursive project than the one that is picked up on the command line. 
>
> I'm guessing that java -version on the command line will show Java 8, but 
> the one you have configured in your Cursive project (File->Project 
> Structure->Project->Project SDK and File->Project Structure->Modules->(your 
> module)->Module SDK) is less than that. Is that the case?
>
> On 22 August 2015 at 23:58, William la Forge  > wrote:
>
>> Bingo! Everything works when I revert to clojure 1.6.0.
>>
>>
>> On Saturday, August 22, 2015 at 5:49:24 PM UTC-4, William la Forge wrote:
>>>
>>> More weirdness. This works:
>>>
>>> (let [^Object aa (.seq a5)]
>>>   (println (.getClass aa)))
>>>
>>>
>>> But not this:
>>>
>>>
>>> (let [^AASetSequence aa (.seq a5)]
>>>   (println (.getClass aa
>>>
>>>
>>> Nor, of course, this:
>>>
>>>
>>> (let [^AASetSequence aa (.seq a5)]
>>>   (println (.count aa)))
>>>
>>>
>>> Here's the error I'm getting now:
>>>
>>>
>>> Information:8/22/2015 5:45 PM - Compilation completed with 1 error and 0 
>>> warnings in 2s 743ms
>>> C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj
>>> Error:(26, 12) clojure: java.lang.NoClassDefFoundError: 
>>> java/util/function/UnaryOperator, 
>>> compiling:(aa_collections/immutable_set_test.clj:26:12)
>>> java.lang.ClassNotFoundException: java.util.function.UnaryOperator
>>>  at java.net.URLClassLoader$1.run (URLClassLoader.java:366)
>>> java.net.URLClassLoader$1.run (URLClassLoader.java:355)
>>> java.security.AccessController.doPrivileged (AccessController.java:-2)
>>> java.net.URLClassLoader.findClass (URLClassLoader.java:354)
>>> java.lang.ClassLoader.loadClass (ClassLoader.java:425)
>>> java.lang.ClassLoader.loadClass (ClassLoader.java:358)
>>> java.lang.Class.getDeclaredMethods0 (Class.java:-2)
>>> java.lang.Class.privateGetDeclaredMethods (Class.java:2570)
>>> java.lang.Class.privateGetPublicMethods (Class.java:2690)
>>> java.lang.Class.getMethods (Class.java:1467)
>>>
>>>
>>>
>>> On Saturday, August 22, 2015 at 5:37:13 PM UTC-4, William la Forge wrote:

 Hi Colin!

 I've set it up to compile all. No doubt this will be very helpful as I 
 will no longer need to compile using an external `lein compile`. But run 
 still dies on the call (.getClass x), when x is a gen-class compiled class 
 instance.

 On the other hand I still can not credit this as a Cursive bug. Calling 
 methods on gen-class compiled class instances is to basic. But it is 
 likely 
 related to Cursive, as 'lein test' works great.

 On Saturday, August 22, 2015 at 4:24:40 PM UTC-4, Colin Fleming wrote:
>
> Hi William,
>
> Right, you'll need to tell Cursive to compile that namespace in 
> *Settings->Build, 
> Execution, Deployment->Compiler->Clojure Compiler*. Once you've done 
> that things should work. Cursive doesn't currently pick the set of 
> namespaces to be compiled up from lein - it probably should.
>
> Cheers,
> Colin
>
> On 22 August 2015 at 17:17, William la Forge  
> wrote:
>
>> I searched and did not see anything recent on gen-class problems in 
>> Cursive. I find when I have a reference to a gen-class instance that 
>> instance? works in Cursive but .getClass does not. (Everything works 
>> with 
>> lein, of course.)
>>
>> What I am trying to do is to call the count method via (.count x). 
>> What I do not want to do is call the clojure count function, (count x). 
>> Again, no issues with lein. 
>>
>> I suspect I simply have not completed the setup cursive for compiles 
>> or something, as all the complaints about cursive/gen-class that I could 
>> find were a year old.
>>
>> I know I need to switch to emacs at some times. I mean, it's only 
>> been 30 years since I used it last. :D
>>
>> Here's the error I'm getting:
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError: 
>> java/util/function/UnaryOperator, 
>> compiling:(C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj:22:10)
>> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6730)
>> at clojure.lang.Compiler.analyze(Compiler.java:6524)
>> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
>> at clojure.lang.Compiler.analyze(Compiler.java:6524)
>> at clojure.lang.Compiler.analyze(Compiler.java:6485)
>> at clojure.lang.Compiler$

Fwd: Finding all Entities in a given partition

2015-08-22 Thread Alan Thompson
Hi,

An email to the Datomic mailing list piqued my interest, so I have added a
new funtion to the Tupelo Datomic library which allows the user to easily
(& efficiently) retrieve all Entity IDs (EIDs) from a given partition
(specified as a keyword).

For example, suppose in our James Bond Unit Test

we
wish to add Honey Rider to the partition :people.  Then we could use code
like this:

ns tst.tupelo.datomic-bond
  (:require [tupelo.datomic   :as td] ...

  ; Create a partition named :people (we could namespace it like
:db.part/people if we wished)
  (td/transact *conn*
(td/new-partition :people ))

  ; Create Honey Rider and add her to the :people partition
  (let [tx-result   @(td/transact *conn*
(td/new-entity :people ; <- partition is first arg
(optional) to td/new-entity
  { :person/name "Honey Rider" :location
"Caribbean" :weapon/type #{:weapon/knife} } ))
[honey-eid]  (td/eids tx-result)  ; retrieve Honey Rider's EID from
the seq (destructuring)
  ]
(is (s/validate ts/Eid honey-eid))  ; verify the expected type
(is (= :people  ; verify the partition name for
Honey's EID
   (td/partition-name (live-db) honey-eid)))

Suppose we wanted a listing of all EIDs in the :people partition.  The
simple way is to use the new function partition-eids as follows:

; Show that only Honey is in the people partition
(let [people-eids   (td/partition-eids (live-db) :people)
  people-entity-maps(map #(td/entity-map (live-db) %)
people-eids) ]
  (is (= people-entity-maps [
   {:person/name "Honey Rider", :weapon/type #{:weapon/knife},
:location "Caribbean"} ] )))

So Honey is, indeed, the only person in the newly created :people partition,
and we have used the handy function entity-map to convert her EID into a
normal Clojure map for further processing.

Enjoy!
Alan

-- 
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.


Re: Finding all Entities in a given partition

2015-08-22 Thread Alan Thompson
I forgot to include the GitHub link:  https://github.com/cloojure/tupelo

Tupelo Datomic (and the rest of the Tupelo library) is intended to make it
easier & more effortless to use Datomic (and Clojure in general).

Enjoy!
Alan

On Sat, Aug 22, 2015 at 5:18 PM, Alan Thompson  wrote:

>
> Hi,
>
> An email to the Datomic mailing list piqued my interest, so I have added a
> new funtion to the Tupelo Datomic library which allows the user to easily
> (& efficiently) retrieve all Entity IDs (EIDs) from a given partition
> (specified as a keyword).
>
> For example, suppose in our James Bond Unit Test
> 
>  we
> wish to add Honey Rider to the partition :people.  Then we could use code
> like this:
>
> ns tst.tupelo.datomic-bond
>   (:require [tupelo.datomic   :as td] ...
>
>   ; Create a partition named :people (we could namespace it like
> :db.part/people if we wished)
>   (td/transact *conn*
> (td/new-partition :people ))
>
>   ; Create Honey Rider and add her to the :people partition
>   (let [tx-result   @(td/transact *conn*
> (td/new-entity :people ; <- partition is first arg
> (optional) to td/new-entity
>   { :person/name "Honey Rider" :location
> "Caribbean" :weapon/type #{:weapon/knife} } ))
> [honey-eid]  (td/eids tx-result)  ; retrieve Honey Rider's EID
> from the seq (destructuring)
>   ]
> (is (s/validate ts/Eid honey-eid))  ; verify the expected type
> (is (= :people  ; verify the partition name for
> Honey's EID
>(td/partition-name (live-db) honey-eid)))
>
> Suppose we wanted a listing of all EIDs in the :people partition.  The
> simple way is to use the new function partition-eids as follows:
>
> ; Show that only Honey is in the people partition
> (let [people-eids   (td/partition-eids (live-db) :people)
>   people-entity-maps(map #(td/entity-map (live-db) %)
> people-eids) ]
>   (is (= people-entity-maps [
>{:person/name "Honey Rider", :weapon/type #{:weapon/knife},
> :location "Caribbean"} ] )))
>
> So Honey is, indeed, the only person in the newly created :people partition,
> and we have used the handy function entity-map to convert her EID into a
> normal Clojure map for further processing.
>
> Enjoy!
> Alan
>
>
>

-- 
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.


Re: decoding clojure generated class names

2015-08-22 Thread Fluid Dynamics
On Saturday, August 22, 2015 at 7:28:32 PM UTC-4, Alex Miller wrote:
>
> There is a demunge function in clojure.lang.Compiler. It's not foolproof 
> as the munging is not unambiguously reversible.


If the munging process loses information, isn't there a (theoretical, at 
least) risk of name collisions in the output?

-- 
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.


Re: Cursive and gen-class

2015-08-22 Thread William la Forge
Loving this. I had uninstalled cursive so I could reinstall. But the 
download of the plugin fails and when installing from disk it says 
cursive-14-0.1.60 is not compatible. (I'm running with idea 14.1.4.)

Deleted the idea system cache, restarted, still incompatible. :-(



On Saturday, August 22, 2015 at 8:12:30 PM UTC-4, William la Forge wrote:
>
> lean version shows java 8, but the ide sdk is java7. Didn't know they 
> would be connected. :0
>
> On Saturday, August 22, 2015 at 6:56:46 PM UTC-4, Colin Fleming wrote:
>>
>> That's very strange. I'd need more detailed instructions to try to 
>> reproduce this. But the class it can't find is new in Java 8 so it looks 
>> like you have a JVM version issue. I suspect that this shows up in Cursive 
>> but not in lein because you're using a different JDK version in your 
>> Cursive project than the one that is picked up on the command line. 
>>
>> I'm guessing that java -version on the command line will show Java 8, but 
>> the one you have configured in your Cursive project (File->Project 
>> Structure->Project->Project SDK and File->Project Structure->Modules->(your 
>> module)->Module SDK) is less than that. Is that the case?
>>
>> On 22 August 2015 at 23:58, William la Forge  wrote:
>>
>>> Bingo! Everything works when I revert to clojure 1.6.0.
>>>
>>>
>>> On Saturday, August 22, 2015 at 5:49:24 PM UTC-4, William la Forge wrote:

 More weirdness. This works:

 (let [^Object aa (.seq a5)]
   (println (.getClass aa)))


 But not this:


 (let [^AASetSequence aa (.seq a5)]
   (println (.getClass aa


 Nor, of course, this:


 (let [^AASetSequence aa (.seq a5)]
   (println (.count aa)))


 Here's the error I'm getting now:


 Information:8/22/2015 5:45 PM - Compilation completed with 1 error and 0 
 warnings in 2s 743ms
 C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj
 Error:(26, 12) clojure: java.lang.NoClassDefFoundError: 
 java/util/function/UnaryOperator, 
 compiling:(aa_collections/immutable_set_test.clj:26:12)
 java.lang.ClassNotFoundException: java.util.function.UnaryOperator
  at java.net.URLClassLoader$1.run (URLClassLoader.java:366)
 java.net.URLClassLoader$1.run (URLClassLoader.java:355)
 java.security.AccessController.doPrivileged (AccessController.java:-2)
 java.net.URLClassLoader.findClass (URLClassLoader.java:354)
 java.lang.ClassLoader.loadClass (ClassLoader.java:425)
 java.lang.ClassLoader.loadClass (ClassLoader.java:358)
 java.lang.Class.getDeclaredMethods0 (Class.java:-2)
 java.lang.Class.privateGetDeclaredMethods (Class.java:2570)
 java.lang.Class.privateGetPublicMethods (Class.java:2690)
 java.lang.Class.getMethods (Class.java:1467)



 On Saturday, August 22, 2015 at 5:37:13 PM UTC-4, William la Forge 
 wrote:
>
> Hi Colin!
>
> I've set it up to compile all. No doubt this will be very helpful as I 
> will no longer need to compile using an external `lein compile`. But run 
> still dies on the call (.getClass x), when x is a gen-class compiled 
> class 
> instance.
>
> On the other hand I still can not credit this as a Cursive bug. 
> Calling methods on gen-class compiled class instances is to basic. But it 
> is likely related to Cursive, as 'lein test' works great.
>
> On Saturday, August 22, 2015 at 4:24:40 PM UTC-4, Colin Fleming wrote:
>>
>> Hi William,
>>
>> Right, you'll need to tell Cursive to compile that namespace in 
>> *Settings->Build, 
>> Execution, Deployment->Compiler->Clojure Compiler*. Once you've done 
>> that things should work. Cursive doesn't currently pick the set of 
>> namespaces to be compiled up from lein - it probably should.
>>
>> Cheers,
>> Colin
>>
>> On 22 August 2015 at 17:17, William la Forge  
>> wrote:
>>
>>> I searched and did not see anything recent on gen-class problems in 
>>> Cursive. I find when I have a reference to a gen-class instance that 
>>> instance? works in Cursive but .getClass does not. (Everything works 
>>> with 
>>> lein, of course.)
>>>
>>> What I am trying to do is to call the count method via (.count x). 
>>> What I do not want to do is call the clojure count function, (count x). 
>>> Again, no issues with lein. 
>>>
>>> I suspect I simply have not completed the setup cursive for compiles 
>>> or something, as all the complaints about cursive/gen-class that I 
>>> could 
>>> find were a year old.
>>>
>>> I know I need to switch to emacs at some times. I mean, it's only 
>>> been 30 years since I used it last. :D
>>>
>>> Here's the error I'm getting:
>>>
>>> Exception in thread "main" java.lang.NoClassDefFoundError: 
>>> j

Re: Rabid wild animals in my clojure argument lists, code gets infected.

2015-08-22 Thread Colin Yates
Hi Dave, it _isn't_ an Illegal argument though :-), your destructuring
is simply ignoring that parameter.

However, I get the pain and solutions might be (in order of 'heavyness'):
 - http://blog.fogus.me/2009/12/21/clojures-pre-and-post/
 - https://github.com/Prismatic/schema
 - http://typedclojure.org/

HTH

Dave Tenny writes:

> I sure wish Clojure would generate "IllegalArgumentException" in the
> following sample case:
>
> (defn foo [a b & {:keys [c d]}] 1)
> (foo 1 2 :e 5) ; blithely ignores :e 5
>
> I understand that Clojure's destructuring things are very nice, and more
> powerful than Common Lisp's, and I like
> that when I need it.
>
> However I can't tell you how many times I've been bitten by this. Some
> simple typo or other other parameter name error on keyword arguments
> with untended and way-too-long-to-debug consequences.
>
> In my mind, on this subject, Common Lisp lambda lists got this right and
> Clojure gets a poor grade.
> Something about being doomed to repeat history.  In Common Lisp, if you
> really wanted to allow other (arbitrary) keywords you'd
> just use &allow-other-keys.
>
> Maybe clojure should only allow the above case to go un-complained-about if
> :as was specified for the map.
>
> If there's some automatic enforcement I'm missing that comes with 'defn'
> please let me know, I'm still learning the language.
>
> I've thought more that once about making a common lisp DEFUN statement that
> maps to DEFN but implements
> lambda list semantics (including 'supplied-p' parameters).  I've just been
> too lazy to do it.
>
> It would also likely perform poorly after injecting the additional
> checks/rearrangements into the function on top of what Clojure has already
> done,
> so I suppose it would have to be taken a step further so that it didn't
> generate DEFN expressions at all but was implemented at DEFN's level as
> a seperately named form.
>
> Tips welcome.  Just thinking aloud.
>
> - Dave

--
Sent with my mu4e

-- 
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.


Re: Cursive and gen-class

2015-08-22 Thread William la Forge
Woh! I had to revert to 14.0.2 before idea accepted the clojure plugin as 
being compatible. 

On Saturday, August 22, 2015 at 8:42:42 PM UTC-4, William la Forge wrote:
>
> Loving this. I had uninstalled cursive so I could reinstall. But the 
> download of the plugin fails and when installing from disk it says 
> cursive-14-0.1.60 is not compatible. (I'm running with idea 14.1.4.)
>
> Deleted the idea system cache, restarted, still incompatible. :-(
>
>
>
> On Saturday, August 22, 2015 at 8:12:30 PM UTC-4, William la Forge wrote:
>>
>> lean version shows java 8, but the ide sdk is java7. Didn't know they 
>> would be connected. :0
>>
>> On Saturday, August 22, 2015 at 6:56:46 PM UTC-4, Colin Fleming wrote:
>>>
>>> That's very strange. I'd need more detailed instructions to try to 
>>> reproduce this. But the class it can't find is new in Java 8 so it looks 
>>> like you have a JVM version issue. I suspect that this shows up in Cursive 
>>> but not in lein because you're using a different JDK version in your 
>>> Cursive project than the one that is picked up on the command line. 
>>>
>>> I'm guessing that java -version on the command line will show Java 8, 
>>> but the one you have configured in your Cursive project (File->Project 
>>> Structure->Project->Project SDK and File->Project Structure->Modules->(your 
>>> module)->Module SDK) is less than that. Is that the case?
>>>
>>> On 22 August 2015 at 23:58, William la Forge  wrote:
>>>
 Bingo! Everything works when I revert to clojure 1.6.0.


 On Saturday, August 22, 2015 at 5:49:24 PM UTC-4, William la Forge 
 wrote:
>
> More weirdness. This works:
>
> (let [^Object aa (.seq a5)]
>   (println (.getClass aa)))
>
>
> But not this:
>
>
> (let [^AASetSequence aa (.seq a5)]
>   (println (.getClass aa
>
>
> Nor, of course, this:
>
>
> (let [^AASetSequence aa (.seq a5)]
>   (println (.count aa)))
>
>
> Here's the error I'm getting now:
>
>
> Information:8/22/2015 5:45 PM - Compilation completed with 1 error and 0 
> warnings in 2s 743ms
> C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj
> Error:(26, 12) clojure: java.lang.NoClassDefFoundError: 
> java/util/function/UnaryOperator, 
> compiling:(aa_collections/immutable_set_test.clj:26:12)
> java.lang.ClassNotFoundException: java.util.function.UnaryOperator
>  at java.net.URLClassLoader$1.run (URLClassLoader.java:366)
> java.net.URLClassLoader$1.run (URLClassLoader.java:355)
> java.security.AccessController.doPrivileged (AccessController.java:-2)
> java.net.URLClassLoader.findClass (URLClassLoader.java:354)
> java.lang.ClassLoader.loadClass (ClassLoader.java:425)
> java.lang.ClassLoader.loadClass (ClassLoader.java:358)
> java.lang.Class.getDeclaredMethods0 (Class.java:-2)
> java.lang.Class.privateGetDeclaredMethods (Class.java:2570)
> java.lang.Class.privateGetPublicMethods (Class.java:2690)
> java.lang.Class.getMethods (Class.java:1467)
>
>
>
> On Saturday, August 22, 2015 at 5:37:13 PM UTC-4, William la Forge 
> wrote:
>>
>> Hi Colin!
>>
>> I've set it up to compile all. No doubt this will be very helpful as 
>> I will no longer need to compile using an external `lein compile`. But 
>> run 
>> still dies on the call (.getClass x), when x is a gen-class compiled 
>> class 
>> instance.
>>
>> On the other hand I still can not credit this as a Cursive bug. 
>> Calling methods on gen-class compiled class instances is to basic. But 
>> it 
>> is likely related to Cursive, as 'lein test' works great.
>>
>> On Saturday, August 22, 2015 at 4:24:40 PM UTC-4, Colin Fleming wrote:
>>>
>>> Hi William,
>>>
>>> Right, you'll need to tell Cursive to compile that namespace in 
>>> *Settings->Build, 
>>> Execution, Deployment->Compiler->Clojure Compiler*. Once you've 
>>> done that things should work. Cursive doesn't currently pick the set of 
>>> namespaces to be compiled up from lein - it probably should.
>>>
>>> Cheers,
>>> Colin
>>>
>>> On 22 August 2015 at 17:17, William la Forge  
>>> wrote:
>>>
 I searched and did not see anything recent on gen-class problems in 
 Cursive. I find when I have a reference to a gen-class instance that 
 instance? works in Cursive but .getClass does not. (Everything works 
 with 
 lein, of course.)

 What I am trying to do is to call the count method via (.count x). 
 What I do not want to do is call the clojure count function, (count 
 x). 
 Again, no issues with lein. 

 I suspect I simply have not completed the setup cursive for 
 compiles or something, as all the complaints about cursi

Re: Cursive and gen-class

2015-08-22 Thread Fluid Dynamics
On Saturday, August 22, 2015 at 8:42:42 PM UTC-4, William la Forge wrote:
>
> Loving this. I had uninstalled cursive so I could reinstall. But the 
> download of the plugin fails and when installing from disk it says 
> cursive-14-0.1.60 is not compatible. (I'm running with idea 14.1.4.)
>
> Deleted the idea system cache, restarted, still incompatible. :-(
>

It never ceases to amaze me that people pay for proprietary junk like 
IntelliJ and Windoze that are prone to hose themselves to the point of 
needing a format+reinstall to get them working again, while there are good, 
free alternatives out there like Eclipse/CCW and Linux that Just Work(tm).

-- 
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.


Re: Cursive and gen-class

2015-08-22 Thread William la Forge
Set the ide to Java 8 and clojure 1.7. And now it works great. Good catch. 
Thanks!

As for Cursive, I'm guessing it is set to be compatible with idea 14.0.x, 
though fortunately when you go to 14.1 the plugins get grandfathered in. 
Which is a bit weird!

On Saturday, August 22, 2015 at 8:12:30 PM UTC-4, William la Forge wrote:
>
> lean version shows java 8, but the ide sdk is java7. Didn't know they 
> would be connected. :0
>
> On Saturday, August 22, 2015 at 6:56:46 PM UTC-4, Colin Fleming wrote:
>>
>> That's very strange. I'd need more detailed instructions to try to 
>> reproduce this. But the class it can't find is new in Java 8 so it looks 
>> like you have a JVM version issue. I suspect that this shows up in Cursive 
>> but not in lein because you're using a different JDK version in your 
>> Cursive project than the one that is picked up on the command line. 
>>
>> I'm guessing that java -version on the command line will show Java 8, but 
>> the one you have configured in your Cursive project (File->Project 
>> Structure->Project->Project SDK and File->Project Structure->Modules->(your 
>> module)->Module SDK) is less than that. Is that the case?
>>
>> On 22 August 2015 at 23:58, William la Forge  wrote:
>>
>>> Bingo! Everything works when I revert to clojure 1.6.0.
>>>
>>>
>>> On Saturday, August 22, 2015 at 5:49:24 PM UTC-4, William la Forge wrote:

 More weirdness. This works:

 (let [^Object aa (.seq a5)]
   (println (.getClass aa)))


 But not this:


 (let [^AASetSequence aa (.seq a5)]
   (println (.getClass aa


 Nor, of course, this:


 (let [^AASetSequence aa (.seq a5)]
   (println (.count aa)))


 Here's the error I'm getting now:


 Information:8/22/2015 5:45 PM - Compilation completed with 1 error and 0 
 warnings in 2s 743ms
 C:\Users\Bill\Documents\GitHub\aa-collections\test\aa_collections\immutable_set_test.clj
 Error:(26, 12) clojure: java.lang.NoClassDefFoundError: 
 java/util/function/UnaryOperator, 
 compiling:(aa_collections/immutable_set_test.clj:26:12)
 java.lang.ClassNotFoundException: java.util.function.UnaryOperator
  at java.net.URLClassLoader$1.run (URLClassLoader.java:366)
 java.net.URLClassLoader$1.run (URLClassLoader.java:355)
 java.security.AccessController.doPrivileged (AccessController.java:-2)
 java.net.URLClassLoader.findClass (URLClassLoader.java:354)
 java.lang.ClassLoader.loadClass (ClassLoader.java:425)
 java.lang.ClassLoader.loadClass (ClassLoader.java:358)
 java.lang.Class.getDeclaredMethods0 (Class.java:-2)
 java.lang.Class.privateGetDeclaredMethods (Class.java:2570)
 java.lang.Class.privateGetPublicMethods (Class.java:2690)
 java.lang.Class.getMethods (Class.java:1467)



 On Saturday, August 22, 2015 at 5:37:13 PM UTC-4, William la Forge 
 wrote:
>
> Hi Colin!
>
> I've set it up to compile all. No doubt this will be very helpful as I 
> will no longer need to compile using an external `lein compile`. But run 
> still dies on the call (.getClass x), when x is a gen-class compiled 
> class 
> instance.
>
> On the other hand I still can not credit this as a Cursive bug. 
> Calling methods on gen-class compiled class instances is to basic. But it 
> is likely related to Cursive, as 'lein test' works great.
>
> On Saturday, August 22, 2015 at 4:24:40 PM UTC-4, Colin Fleming wrote:
>>
>> Hi William,
>>
>> Right, you'll need to tell Cursive to compile that namespace in 
>> *Settings->Build, 
>> Execution, Deployment->Compiler->Clojure Compiler*. Once you've done 
>> that things should work. Cursive doesn't currently pick the set of 
>> namespaces to be compiled up from lein - it probably should.
>>
>> Cheers,
>> Colin
>>
>> On 22 August 2015 at 17:17, William la Forge  
>> wrote:
>>
>>> I searched and did not see anything recent on gen-class problems in 
>>> Cursive. I find when I have a reference to a gen-class instance that 
>>> instance? works in Cursive but .getClass does not. (Everything works 
>>> with 
>>> lein, of course.)
>>>
>>> What I am trying to do is to call the count method via (.count x). 
>>> What I do not want to do is call the clojure count function, (count x). 
>>> Again, no issues with lein. 
>>>
>>> I suspect I simply have not completed the setup cursive for compiles 
>>> or something, as all the complaints about cursive/gen-class that I 
>>> could 
>>> find were a year old.
>>>
>>> I know I need to switch to emacs at some times. I mean, it's only 
>>> been 30 years since I used it last. :D
>>>
>>> Here's the error I'm getting:
>>>
>>> Exception in thread "main" java.lang.NoClassDefFoundError: 
>>> java/util/function/Un

Re: Rabid wild animals in my clojure argument lists, code gets infected.

2015-08-22 Thread James Reeves
https://github.com/roomkey/annotate is another possibility

- James

On 23 August 2015 at 02:06, Colin Yates  wrote:

> Hi Dave, it _isn't_ an Illegal argument though :-), your destructuring
> is simply ignoring that parameter.
>
> However, I get the pain and solutions might be (in order of 'heavyness'):
>  - http://blog.fogus.me/2009/12/21/clojures-pre-and-post/
>  - https://github.com/Prismatic/schema
>  - http://typedclojure.org/
>
> HTH
>
> Dave Tenny writes:
>
> > I sure wish Clojure would generate "IllegalArgumentException" in the
> > following sample case:
> >
> > (defn foo [a b & {:keys [c d]}] 1)
> > (foo 1 2 :e 5) ; blithely ignores :e 5
> >
> > I understand that Clojure's destructuring things are very nice, and more
> > powerful than Common Lisp's, and I like
> > that when I need it.
> >
> > However I can't tell you how many times I've been bitten by this. Some
> > simple typo or other other parameter name error on keyword arguments
> > with untended and way-too-long-to-debug consequences.
> >
> > In my mind, on this subject, Common Lisp lambda lists got this right and
> > Clojure gets a poor grade.
> > Something about being doomed to repeat history.  In Common Lisp, if you
> > really wanted to allow other (arbitrary) keywords you'd
> > just use &allow-other-keys.
> >
> > Maybe clojure should only allow the above case to go un-complained-about
> if
> > :as was specified for the map.
> >
> > If there's some automatic enforcement I'm missing that comes with 'defn'
> > please let me know, I'm still learning the language.
> >
> > I've thought more that once about making a common lisp DEFUN statement
> that
> > maps to DEFN but implements
> > lambda list semantics (including 'supplied-p' parameters).  I've just
> been
> > too lazy to do it.
> >
> > It would also likely perform poorly after injecting the additional
> > checks/rearrangements into the function on top of what Clojure has
> already
> > done,
> > so I suppose it would have to be taken a step further so that it didn't
> > generate DEFN expressions at all but was implemented at DEFN's level as
> > a seperately named form.
> >
> > Tips welcome.  Just thinking aloud.
> >
> > - Dave
>
> --
> Sent with my mu4e
>
> --
> 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.
>

-- 
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.


Re: decoding clojure generated class names

2015-08-22 Thread Alex Miller
Yes. Specifically, - and _ both map to _ so foo-bar and foo_bar generate the 
same class name. So don't do that.

-- 
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.


Boot-CLJ: How to daemonize a run script?

2015-08-22 Thread Raymond Huang
I've been checking out boot lately, and I want to run my application using 
a boot script.

I have an aleph HTTP server started, but the main thread exits so my 
application never starts. 

What's the idiomatic way of preventing my main thread from exiting? How 
does generating an uberjar with leiningen do this?

-- 
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.