Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread jarppe
On Sunday, December 16, 2012 9:57:26 PM UTC+2, Jonathan Fischer Friberg wrote: I don't know why it doesn't work. However, changing defgreeter to the following seems work. (defmacro defgreeter [greeter-name] (let [greeter (make-greeter)] `(def ~greeter-name ~greeter))) Might be

Re: How to structure a Clojure day for noobs?

2012-12-17 Thread Marko Topolnik
I think, however, that there is a risk of a disconnect, where newcomers don't really grasp that there is a JVM running and that code is actually compiled and injected into it, and that it's for real. They are used to mickey mouse interactive tools that don't provide the real thing, and

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread Ben Smith-Mannschott
Your macro: *(*~greeter user-name#*)* * * Is producing a list of a function or closure followed by a symbol. The first element of the list your macro builds must instead be an expression that can be evaluated to a function. (For example a symbol naming a function or an (fn [] ...)

Re: Running a clojure script

2012-12-17 Thread Shantanu Kumar
On Monday, 17 December 2012 00:23:08 UTC+5:30, puzzler wrote: On Sun, Dec 16, 2012 at 10:06 AM, Armando Blancas abm2...@gmail.comjavascript: wrote: I'm not going out of my way to be pseudonymous, it just seems to be a feature of the group. I thought, Mark asking how to run a

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread Marko Topolnik
On Monday, December 17, 2012 9:28:20 AM UTC+1, bsmith.occs wrote: Your macro: *(*~greeter user-name#*)* * * Is producing a list of a function or closure followed by a symbol. The first element of the list your macro builds must instead be an expression that can be evaluated

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread Alex Baranosky
Function values can't be read by the reader. I'm not sure how any versions of this code work. On Mon, Dec 17, 2012 at 12:32 AM, Marko Topolnik marko.topol...@gmail.comwrote: On Monday, December 17, 2012 9:28:20 AM UTC+1, bsmith.occs wrote: Your macro: *(*~greeter user-name#*)* *

Re: core/group-by with optional value-mapper function

2012-12-17 Thread Daniel Dinnyes
Hi, I expect the cost of calling `identity` to be negligible. Not for sure, but the JVM might even inline it at run-time, or there might be optimizations for it in clojure.core during compilation... I cannot comment on that. But even with a full virtual call, it should be faster than iterating

Re: JavaFX and Clojure

2012-12-17 Thread Stathis Sideris
Have you considered using the doto macro in order to avoid having to repeat the component as the first argument of all the setters? (let [btn (Button.)] (.setLayoutX btn 100) (.setLayoutY btn 150) (.setText btn Hello World!)) becomes: (doto (Button.) (.setLayoutX 100) (.setLayoutY

Re: Confused about comp

2012-12-17 Thread Dick Davies
On 16 December 2012 10:59, Peter West peter.b.w...@gmail.com wrote: This effect is, on the face of it, unpredictable: you just have to know that that is what apply does. Users of clojure learn that pretty quickly. I've just learned it. Doc doesn't help. user= (doc apply) If you're using

New Clojure user group in Israel

2012-12-17 Thread Daniel Szmulewicz
Hi everybody, Happy to announce that Israel has its first Clojure user group. http://www.meetup.com/Clojure-Israel/ Sincerely, Daniel Szmulewicz -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: core/group-by with optional value-mapper function

2012-12-17 Thread Daniel Dinnyes
Also note that I wrote in my first post that Without the value-mapper argument it is very awkward to achieve the same structure after the group-by call. The `map-vals` function is almost the closest you can get to map values after a group-by in a streamlined and clean manner. There is `

Re: Confused about comp

2012-12-17 Thread Peter West
Thanks. That's much better. On Monday, December 17, 2012 8:53:22 PM UTC+10, Dick Davies wrote: If you're using leiningen (2 at least, maybe 1?) then a (user/clojuredocs apply) is a much better how do I drive this thing? than a straight (doc ...) call. -- You received this message

Re: core/group-by with optional value-mapper function

2012-12-17 Thread László Török
Hi, I have come across use cases in the past where an additional transformation step was indeed very handy and I wrote my own version of group-by, one identical to Daniel's. Maybe a function worthwhile for c.c.incubator. Las 2012/12/17 Daniel Dinnyes dinny...@gmail.com Also note that I wrote

Tail call in multi method?

2012-12-17 Thread bruce li
Hello, everyone. I'm currently trying to model an automata using multi-method. So in my code, I have something like: (defmethod trans :state [state] ; ... (trans .. In the last line, the trans will be called with some different state. However, it seems that such call

Re: Tail call in multi method?

2012-12-17 Thread juan.facorro
What about recur http://clojure.org/special_forms#recur? It's a special form used for tail call optimizations. Juan On Monday, December 17, 2012 1:32:31 PM UTC-3, bruce li wrote: Hello, everyone. I'm currently trying to model an automata using multi-method. So in my code, I have

Re: Tail call in multi method?

2012-12-17 Thread Jonas
recur doesn't work well with multimethods: (defmulti foo identity) (defmethod foo 1 [n] (recur (dec n))) (defmethod foo 0 [n] :ok) (foo 1) ;; runs forever Jonas On Monday, December 17, 2012 6:56:34 PM UTC+2, juan.facorro wrote: What about recur

Re: Tail call in multi method?

2012-12-17 Thread juan.facorro
You're right, it fails when the call to recur should dispatch to another method. But as long as you are calling the same implementation it does seem to work: *(ns multi-recur)* * * *(defmulti tail-call #(first %))* * * *(defmethod tail-call :recur [x n]* * (if (zero? n)* *(println x Made

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread Ben Smith-Mannschott
On Mon, Dec 17, 2012 at 11:08 AM, Alex Baranosky alexander.barano...@gmail.com wrote: Function values can't be read by the reader. I'm not sure how any versions of this code work. It is true that a function value can not be printed and then read back in, but I don't think that's relevant

Re: Tail call in multi method?

2012-12-17 Thread Chas Emerick
`recur` throws control flow to the nearest `loop` head or fn body, and each method is itself a function, so `recur` within a method body will simply jump to the start of the method, _not_ tail-call the multimethod. e.g.: = (defmulti foo type) #'user/foo = (defmethod foo Long [x]

Re: Tail call in multi method?

2012-12-17 Thread Ben Wolfson
On Mon, Dec 17, 2012 at 9:32 AM, Chas Emerick c...@cemerick.com wrote: What you're trying to do is really a special case of mutual recursion: because Clojure's methods are separate functions, calling back through the multimethod (and its dispatch fn) will always consume stack space. The

Re: Tail call in multi method?

2012-12-17 Thread Chas Emerick
On Dec 17, 2012, at 12:39 PM, Ben Wolfson wrote: On Mon, Dec 17, 2012 at 9:32 AM, Chas Emerick c...@cemerick.com wrote: What you're trying to do is really a special case of mutual recursion: because Clojure's methods are separate functions, calling back through the multimethod (and its

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread Marko Topolnik
On Mon, Dec 17, 2012 at 11:08 AM, Alex Baranosky alexander...@gmail.comjavascript: wrote: Function values can't be read by the reader. I'm not sure how any versions of this code work. It is true that a function value can not be printed and then read back in, but I don't think that's

Re: Belgian Clojure base meetup?

2012-12-17 Thread Sébastien Wagener
Hi Thomas, I'm from Luxembourg. If the meetup isn't too far away from the border, I would be interested. Sébastien 2012/12/16 Thomas Goossens cont...@thomasgoossens.be If you are from Belgium, Don't get too excited - yet - . I've been wondering about organising a small meetup somewhere

Re: ANN: lein-clr 0.2.0 for ClojureCLR

2012-12-17 Thread dmiller
Aaron, tools.logging and nrepl are important. I'm glad to see the effort. I haven't forgotten about your single-DLL work. I'm going to have plenty of time next week if you can get something to me. -David On Saturday, December 15, 2012 5:15:16 PM UTC-6, Aaron wrote: Cool. I'm just seeing

Re: core/group-by with optional value-mapper function

2012-12-17 Thread Alex Baranosky
I think it sounds like a nice addition, after mulling it over a little. On Mon, Dec 17, 2012 at 4:47 AM, László Török ltoro...@gmail.com wrote: Hi, I have come across use cases in the past where an additional transformation step was indeed very handy and I wrote my own version of group-by,

Re: ClojureCLR errors on Mono Linux

2012-12-17 Thread dmiller
Shantanu, I don't have a Linux box available at this point to test, but I'll try it on Mac w/ Mono when I get a chance. I don't have a clue how a field disappears between platforms. -David On Saturday, December 15, 2012 10:15:21 PM UTC-6, Shantanu Kumar wrote: Hi, I noticed the following

Re: Belgian Clojure base meetup?

2012-12-17 Thread Joop Kiefte
I have joined the Amsterdam Clojurians before, but live in Vroenhoven now (near Maastricht, relatively close to Liége). Maybe a meetup around here would be something? :) 2012/12/17 Sébastien Wagener sebastien.wage...@gmail.com Hi Thomas, I'm from Luxembourg. If the meetup isn't too far away

Re: ANN: lein-clr 0.2.0 for ClojureCLR

2012-12-17 Thread Aaron Craelius
Ok, sounds good. I can do that. I have 2-3 pretty specific changes that I can outline. I also have one bug fix (support for IntPtr and UIntPtr in HostExpr). Should I maybe start a separate thread in this group describing the proposed changes or should we do this via JIRA or github? I'm not

Re: Using functions from Java packages

2012-12-17 Thread greg r
Another possibility is the macro memfn. From the documentation: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/memfn Regards, Greg -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Using functions from Java packages

2012-12-17 Thread greg r
Another possibility is the macro memfn. From the documentation: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/memfn Regards, Greg -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: How to structure a Clojure day for noobs?

2012-12-17 Thread Peter Buckley
1. install Leiningen and learn the basics 2. get everyone an editing environment, with the option of using either Emacs, IntelliJ, or Eclipse I would have people do this in advance, or provide a canned environment that has a better chance of just working. There's decent odds that these two steps

Best way to include a passwords file in a project?

2012-12-17 Thread Marco Munizaga
I'm currently doing something like src/project/passwords.clj and git ignoring that, does anyone have a better solution? maybe a way to place the passwords.clj alongside project.clj in the root directory? Would this be possible through leiningen profiles? Thanks -- You received this message

clojure-contrib migrations

2012-12-17 Thread Christopher Meiklejohn
Hi there, I'm inquiring regarding the clojure-contrib migration process. I'd like to offer to step up and maintain clojure-contrib.graph, mainly starting with converting the defstructs over to defrecords so I can start playing around in ClojureScript with this library. What's the process

Re: Clojure Full Syntactical Reference

2012-12-17 Thread Karim A. Nassar
When using nrepl in emacs (cdoc fn) emits: CompilerException java.lang.RuntimeException: Unable to resolve symbol: cdoc in this context, compiling:(NO_SOURCE_PATH:1) However, in lein repl I see: Loading clojuredocs-client... How do I make nrepl as smart as lein repl? On Fri, Dec 14, 2012 at

Re: [ANN] tools.namespace 0.2.2 and Flow 0.1.0

2012-12-17 Thread Mikera
Hi Stuart, Re: tools.namespace, I've found some similar functions in the bultitude library (https://github.com/Raynes/bultitude/tree/master/src/bultitude). Apparently it addresses specific needs that clojure.tools.namespace did not provide. Is one of these recommended over the other, or is

Little namespace question

2012-12-17 Thread Alan Shaw
user= *ns* #Namespace user user= (def user-ns *ns*) #'user/user-ns user= user-ns #Namespace user user= (in-ns user-ns) ClassCastException clojure.lang.Namespace cannot be cast to clojure.lang.Symbol clojure.lang.RT$1.invoke (RT.java:226) It appears I'm not understanding how namespaces are

Re: Little namespace question

2012-12-17 Thread László Török
Try (in-ns 'user-ns) Las On Dec 18, 2012 7:50 AM, Alan Shaw noden...@gmail.com wrote: user= *ns* #Namespace user user= (def user-ns *ns*) #'user/user-ns user= user-ns #Namespace user user= (in-ns user-ns) ClassCastException clojure.lang.Namespace cannot be cast to clojure.lang.Symbol

Re: Little namespace question

2012-12-17 Thread Alan Shaw
Ah no, that puts me in a new user-ns namespace! Not what I wanted! On Mon, Dec 17, 2012 at 10:51 PM, László Török ltoro...@gmail.com wrote: Try (in-ns 'user-ns) Las On Dec 18, 2012 7:50 AM, Alan Shaw noden...@gmail.com wrote: user= *ns* #Namespace user user= (def user-ns *ns*)

Re: clojure-contrib migrations

2012-12-17 Thread Andy Fingerhut
If you want it to remain a Clojure contrib library with a clojure.* namespace, you'll need to sign a Clojure CA to be able to make contributions to it. http://clojure.org/contributing If you want to make it a project on Github or somewhere else, you would probably need to keep the existing

Re: Little namespace question

2012-12-17 Thread László Török
ah, sorry, it's a bit early for me (in-ns (ns-name user-ns)) if you could post a simple example for the second part of your question I maybe able to help. Las Alan Shaw 2012. december 18., kedd napon a következőt írta: Ah no, that puts me in a new user-ns namespace! Not what I wanted! On

Re: Little namespace question

2012-12-17 Thread Alan Shaw
Thanks, Las! Ok say I have a file in which there is string such as (- (atan (bw-noise 902 2 0.7604615575402431 400 400)) (read-image-from-file \images/Dawn_on_Callipygea.png\)) and another version-0-0-1 and I have a namespace version-0-0-1 into which functions named atan etc. are all

Re: Little namespace question

2012-12-17 Thread Baishampayan Ghose
Alan, Something like this might work for you - (defmacro eval-in Eval a Clojure form in a different namespace and switch back to current namespace. Args: code - Clojure form as string ns - Target namespace as string [code ns] `(do (in-ns '~(symbol ns)) (let [ret# (eval

Re: Little namespace question

2012-12-17 Thread Alan Shaw
Thanks BG, I'm trying that. But I don't think it addresses how to get from the string version-0-1-1 to the namespace something.something.version-0-1-1. How can I do that? -A On Mon, Dec 17, 2012 at 11:26 PM, Baishampayan Ghose b.gh...@gmail.comwrote: Alan, Something like this might work

Re: Little namespace question

2012-12-17 Thread Baishampayan Ghose
Alan, What you're asking for is to derive the ns clojure.core given only core. Not sure if that's possible. The namespace constitutes the whole dotted structure and not just the last component, I am afraid. If the actual ns is something.something.version-0-1-1, then you need the string

Re: Little namespace question

2012-12-17 Thread Alan Shaw
Oh yes, the something.something is fixed so I can just prepend it, thanks. (Hadn't noticed your macro takes the ns as a string!) -A On Mon, Dec 17, 2012 at 11:47 PM, Baishampayan Ghose b.gh...@gmail.comwrote: Alan, What you're asking for is to derive the ns clojure.core given only core.