:arglists metadata on defmulti/defmethod forms

2015-08-23 Thread Dave Tenny
defmulti+detmethod doesn't seem to maintain any :arglists metadata with the Var filled by defmulti. How can I look up arglist information for multimethods like I can for regular function vars? -- You received this message because you are subscribed to the Google Groups Clojure group. To

Re: :arglists metadata on defmulti/defmethod forms

2015-08-23 Thread James Reeves
I tend to add the metadata in manually when I write multimethods. (defmulti foo Does some foo to x. {:arglists '([x])} :type) - James On 23 August 2015 at 16:51, Dave Tenny dave.te...@gmail.com wrote: defmulti+detmethod doesn't seem to maintain any :arglists metadata with the Var

Java constructor question

2015-08-23 Thread Dave Tenny
Is there a way to parameterize a bit of code that invokes a constructor without calling the java.lang.reflect.Constructor class? e.g. (defn make-it [class] (new class abc)) ; won't work (make-it IllegalArgumentException) I was trying to parameterize the class of exception thrown in a bit

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

2015-08-23 Thread henrik42
OK, so in this special case you one would just use (def s [{n {id a} d 2 children [{n {id c} d 4 children nil}]} {n {id b} d 3 children nil}]) (some (fn [x] (and (map? x) (some #{{id c}} (vals x (tree-seq coll? seq s)) -- You received this message because

Re: Cursive and gen-class

2015-08-23 Thread Colin Fleming
I totally agree that some people are endlessly amazing. On 23 August 2015 at 03:14, Fluid Dynamics a2093...@trbvm.com wrote: 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

Re: Cursive and gen-class

2015-08-23 Thread Colin Fleming
Hi William, You have to ensure that you download the version of Cursive that corresponds to your IntelliJ version - the links are in the getting started guide here: https://cursiveclojure.com/userguide/. It's unfortunate but necessary that the versions coincide since the IntelliJ APIs change from

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

2015-08-23 Thread Dave Tenny
Note Colin, if I had declared foo differenlty, e.g. (defn foo [a b {:keys [c d]}), that would be slightly different since it requires a map as third argument. But that is not the case with (defn foo [a b {:keys [c d]}]). It may be using maps under the hood, but none of my formal parameters are

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

2015-08-23 Thread James Reeves
On 23 August 2015 at 15:17, Dave Tenny dave.te...@gmail.com wrote: The point of my colorful title and judgmental post is that in the example, passing :e for the declared parameters as declared is a pointless operation at best, and in most practical situations it is also an erroneous

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

2015-08-23 Thread Dave Tenny
The point of my colorful title and judgmental post is that in the example, passing :e for the declared parameters as declared is a pointless operation at best, and in most practical situations it is also an erroneous operation. The language designers have (arguably for the good) chosen to

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

2015-08-23 Thread Dave Tenny
Timothy, I think maps vs keywords is a matter of preference. Certainly there are cases where I use maps of options instead of keywords, but it depends on what I'm doing. Lisp and keywords go way back, and I like keywords when I'm using lisp packages/namespaces as the equivalent of an

Re: decoding clojure generated class names

2015-08-23 Thread Dave Tenny
Thanks Alex, clojure.lang.Compiler/demunge is just what I wanted. On Sat, Aug 22, 2015 at 7:28 PM, Alex Miller a...@puredanger.com wrote: There is a demunge function in clojure.lang.Compiler. It's not foolproof as the munging is not unambiguously reversible. -- You received this message

Boot-CLJ: How to daemonize a run script?

2015-08-23 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

Re: Cursive and gen-class

2015-08-23 Thread William la Forge
OK. NOW I see support for 14.1. Why I didn't see that before! (hand slaps forehead) On Sunday, August 23, 2015 at 4:00:33 AM UTC-4, Colin Fleming wrote: Hi William, You have to ensure that you download the version of Cursive that corresponds to your IntelliJ version - the links are in the

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

2015-08-23 Thread Timothy Baldridge
It's generally considered better practice to pass maps to a function instead of keyword arguments. This also has the nice side-effect of making it easier to call programmatically from other functions. For example: (my-func 1 2 (assoc default-opts :c 42)) is way cleaner than (apply my-func 1 2

Re: Java constructor question

2015-08-23 Thread James Reeves
You could use eval: (defn make-it [class] (eval `(new ~class abc))) That's likely to be less performant than using java.lang.reflect.Constructor though. - James On 23 August 2015 at 21:06, Dave Tenny dave.te...@gmail.com wrote: Is there a way to parameterize a bit of code that invokes a

Java constructor question

2015-08-23 Thread Alex Miller
Use a macro to produce the right code... -- 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

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

2015-08-23 Thread Brian Marick
Andy- wrote: I have yet to evaluate it myself but this might do help you: https://github.com/nathanmarz/specter Specter is great. -- 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

Re: Java constructor question

2015-08-23 Thread Reid McKenzie
So after thinking about Alex and James' respective answers I think the full answer to your question is that no you can't do that for reasons pretty fundamental to the JVM unless you care to constrain the problem domain or qualify your question some more. Making a new class instance is a three