Optimize .addComponent?
I would like to use only one time .addComponent and don't repeat it each time that I need to add something. How I can do it? Perhaps with doto? Are there other way? It is possible to optimize it more? (defn -init [this] (let [app this] (.setMainWindow this (doto (Window. Test application) (.addComponent (Label. Hello!)) (.addComponent (Button. button)) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Optimize .addComponent?
If your code does not grow beyond what you show us, it seems like a good compromise. If you want to be more DRY, here's my take: (defn add-components! [composite components] (doseq [component components] (.addComponent composite component))) (defn -init [this] (let [app this] (.setMainWindow this (doto (Window. Test application) (add-components! (Label. Hello!) (Button. button)) 2011/6/23 Antonio Recio amdx6...@gmail.com: I would like to use only one time .addComponent and don't repeat it each time that I need to add something. How I can do it? Perhaps with doto? Are there other way? It is possible to optimize it more? (defn -init [this] (let [app this] (.setMainWindow this (doto (Window. Test application) (.addComponent (Label. Hello!)) (.addComponent (Button. button)) -- 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 post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Optimize .addComponent?
I obtain an error: javax.servlet.ServletException: java.lang.IllegalArgumentException: Wrong number of args (3) passed to: vapp$add-components-BANG- java.lang.IllegalArgumentException: Wrong number of args (3) passed to: vapp$add-components-BANG- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Optimize .addComponent?
oops, def of add-components should read (defn add-components! [composite components] of course ... 2011/6/23 Laurent PETIT laurent.pe...@gmail.com: If your code does not grow beyond what you show us, it seems like a good compromise. If you want to be more DRY, here's my take: (defn add-components! [composite components] (doseq [component components] (.addComponent composite component))) (defn -init [this] (let [app this] (.setMainWindow this (doto (Window. Test application) (add-components! (Label. Hello!) (Button. button)) 2011/6/23 Antonio Recio amdx6...@gmail.com: I would like to use only one time .addComponent and don't repeat it each time that I need to add something. How I can do it? Perhaps with doto? Are there other way? It is possible to optimize it more? (defn -init [this] (let [app this] (.setMainWindow this (doto (Window. Test application) (.addComponent (Label. Hello!)) (.addComponent (Button. button)) -- 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 post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Screencast: Clojure + Emacs + slime + swank + cake + Overtone
Lee, You're just making a simple typo. To get the REPL to switch to the source file's namespace, you have several options: 1) With the point in the source file, press C-c M-p ENTER 2) With the point in the REPL, type ,in ENTER overtoneproject.core ENTER 3) With the point in the REPL, type (in-ns 'overtoneproject.core) Your mistake was to not quote overtoneproject.core, which made the clojure compiler look up the value of the symbol as a Java class (which it isn't unless you added a :gen-class to the ns form). By quoting it, in-ns gets the symbol overtoneproject.core, which is what it uses to look up namespaces: clojure.core/in-ns ([name]) Sets *ns* to the namespace named by the symbol, creating it if needed. Happy hacking, ~Gary On Jun 21, 11:09 pm, Lee Spector lspec...@hampshire.edu wrote: On Jun 16, 2011, at 11:16 AM, Sam Aaron wrote: I just finished making a screencast primarily for new Overtone users on how to get set up with Emacs as a primary editor: http://vimeo.com/25190186 It turns out that this should be pretty useful for Clojure hackers in general as it's really a screencast on how to set up a Clojure environment using Emacs slime, swank and cake. Just s/Overtone/your-project/ Of course, it's also great if you're interested in making music with programming languages :-) Sam, Thanks so much for this. It's quite nice and it worked for me almost without a glitch (the one glitch being that I had to move a pre-existing .emacs to prevent an error). If I could be excused for briefly looking a gift horse in the mouth I'd also say that as a teacher I think it would be even more fabulous if someone could put together packages (presumably platform-specific packages) that allowed one to do this all in one or two steps, rather than five or six... Installing all of the pieces in one automated process, and also adding the needed lines to the project.clj files etc. Users will want to update/tweak these later, but in the same spirit of this overall package I think it'd be nice to have something that works by default with as few steps as possible. In any event, I do think that this is already quite a nice advance. I have two (related?) questions about working in a REPL in the resulting configuration: - When I have a split screen with a source file and a REPL I can't seem to get the REPL into the namespace of the source file. I can do C-c C-k to evaluate the file and that produces overtone output as expected (and printed output goes to the REPL), but when I then try to do (in-ns overtoneproject.core) in the REPL [overtoneproject.core is the name I used in the ns form in the file] I get a ClassNotFoundException. - I also can't get (load core), or any variant that I could think of, when typed in the REPL to find the file. When I look at the classpath with (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))) I see some of my project's files there, so it knows about the project, but it doesn't find my file in the src directory that cake created. Any pointers would be appreciated. Thanks, -Lee -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Screencast: Clojure + Emacs + slime + swank + cake + Overtone
Thanks so much, Gary. The quoting error is something that I should have seen but didn't :-(, and the two other methods are also great to know about. I'm still having no luck getting load to find things, but I suspect that that is a similarly basic mistake... -Lee On Jun 23, 2011, at 10:08 AM, lambdatronic wrote: Lee, You're just making a simple typo. To get the REPL to switch to the source file's namespace, you have several options: 1) With the point in the source file, press C-c M-p ENTER 2) With the point in the REPL, type ,in ENTER overtoneproject.core ENTER 3) With the point in the REPL, type (in-ns 'overtoneproject.core) Your mistake was to not quote overtoneproject.core, which made the clojure compiler look up the value of the symbol as a Java class (which it isn't unless you added a :gen-class to the ns form). By quoting it, in-ns gets the symbol overtoneproject.core, which is what it uses to look up namespaces: clojure.core/in-ns ([name]) Sets *ns* to the namespace named by the symbol, creating it if needed. Happy hacking, ~Gary On Jun 21, 11:09 pm, Lee Spector lspec...@hampshire.edu wrote: On Jun 16, 2011, at 11:16 AM, Sam Aaron wrote: I just finished making a screencast primarily for new Overtone users on how to get set up with Emacs as a primary editor: http://vimeo.com/25190186 - When I have a split screen with a source file and a REPL I can't seem to get the REPL into the namespace of the source file. I can do C-c C-k to evaluate the file and that produces overtone output as expected (and printed output goes to the REPL), but when I then try to do (in-ns overtoneproject.core) in the REPL [overtoneproject.core is the name I used in the ns form in the file] I get a ClassNotFoundException. - I also can't get (load core), or any variant that I could think of, when typed in the REPL to find the file. When I look at the classpath with (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))) I see some of my project's files there, so it knows about the project, but it doesn't find my file in the src directory that cake created. -- 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
getMethods
I have found a function to get the methods of the classes in the book The Joy of Clojure, and I would like to use it in REPL. Instead of java.awt.Frame I would like to specify the library that I want writing something like (methods any.library). Which is the way to get it? (for [method (seq (.getMethods java.awt.Frame)) :let [method-name (.getName method)]] method-name) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Radically simplified Emacs and SLIME setup
this is really great, thanks for putting this together. i have a (possibly daft) question -- is there a neat way to kill/restart the underlying process. i have looked for a *ahem* clojure-jack-off function or equivalent but couldnt find one in the source. i am just killing it from the terminal at the moment and re-running clojure-jack-in... is there a better way? slime-disconnect seems to leave the underlying process still running in list-processes. thanks again! gaz On Fri, Jun 17, 2011 at 3:35 PM, Jeff Dik s45...@gmail.com wrote: Mark, I got this same error when I copied and pasted the clojure-jack-in function from gmail. I had to remove newlines from (search-backward slime-load-hook) and (slime-connect localhost clojure-swank-port) Hope that helps, Jeff On Sun, Jun 12, 2011 at 8:50 PM, Mark Engelberg mark.engelb...@gmail.com wrote: error in process filter: Search failed: slime-load-hook On Sun, Jun 12, 2011 at 4:51 PM, Phil Hagelberg p...@hagelb.org wrote: On Jun 12, 10:58 am, Mark Engelberg mark.engelb...@gmail.com wrote: I take that back (I had edited the wrong file, which wasn't the one my emacs was using). I get the error Not enough arguments for format string. Oops; I forgot to mention it also needs this: (defvar clojure-swank-command lein jack-in %s ) to replace the old clojure-swank-command defvar. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 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 post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Radically simplified Emacs and SLIME setup
This should do the trick, though I'm not set up with jack-in to test: At the REPL, type comma (the character ,), then sayoonara. On Thu, Jun 23, 2011 at 11:20 AM, gaz jones gareth.e.jo...@gmail.comwrote: this is really great, thanks for putting this together. i have a (possibly daft) question -- is there a neat way to kill/restart the underlying process. i have looked for a *ahem* clojure-jack-off function or equivalent but couldnt find one in the source. i am just killing it from the terminal at the moment and re-running clojure-jack-in... is there a better way? slime-disconnect seems to leave the underlying process still running in list-processes. thanks again! gaz On Fri, Jun 17, 2011 at 3:35 PM, Jeff Dik s45...@gmail.com wrote: Mark, I got this same error when I copied and pasted the clojure-jack-in function from gmail. I had to remove newlines from (search-backward slime-load-hook) and (slime-connect localhost clojure-swank-port) Hope that helps, Jeff On Sun, Jun 12, 2011 at 8:50 PM, Mark Engelberg mark.engelb...@gmail.com wrote: error in process filter: Search failed: slime-load-hook On Sun, Jun 12, 2011 at 4:51 PM, Phil Hagelberg p...@hagelb.org wrote: On Jun 12, 10:58 am, Mark Engelberg mark.engelb...@gmail.com wrote: I take that back (I had edited the wrong file, which wasn't the one my emacs was using). I get the error Not enough arguments for format string. Oops; I forgot to mention it also needs this: (defvar clojure-swank-command lein jack-in %s ) to replace the old clojure-swank-command defvar. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 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 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 post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: getMethods
On 23 June 2011 17:04, Antonio Recio amdx6...@gmail.com wrote: I have found a function to get the methods of the classes in the book The Joy of Clojure, and I would like to use it in REPL. Instead of java.awt.Frame I would like to specify the library that I want writing something like (methods any.library). Which is the way to get it? (for [method (seq (.getMethods java.awt.Frame)) :let [method-name (.getName method)]] method-name) You can do the above like this: (map #(.getName %) (.getMethods java.awt.Frame)) And to turn it into a function, you just do this: (defn class-methods [class-name] (map #(.getName %) (.getMethods class-name))) -- Michael Wood esiot...@gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ANN: Hafni
Hi, This looks pretty cool. I'd love to see a larger example of how you'd apply arrows to managing UI state. From my limited understanding, functions are arrows, but arrows are not functions. The examples you give fall pretty much in the functions are arrows camp, meaning that the code could be written just as easily, and maybe more clearly, by chainging pure functions (please correct me if I'm wrong). I'd like to see an example where FRP clearly makes handling change easier and more functional. When I started working on Seesaw, I did some reading on FRP, but decided I was already up to my neck with learning Clojure. As a result, Seesaw's nice to use, but isn't particularly functional and, as you say, the most annoying parts are those that manipulate the UI. So, I'd also like to explore how Hafni could be used in conjunction with Seesaw. If you have further ideas on this or need help, feel free to contact me. ... and don't feel too bad about writing another Swing wrapper. A month after starting Seesaw, I stumbled upon another, abandoned Clojure+Swing project called ... wait for it... Seesaw. Go figure :) Best regards, Dave On Mon, Jun 20, 2011 at 7:57 AM, Jonathan Fischer Friberg odysso...@gmail.com wrote: Hi, I figured that I would announce a library that I have been working on for a while now. It's called Hafni, and it's a swing wrapper. Why another swing wrapper? I wanted to solve the following problems: 1. There are a lot of boilerplate code needed. 2. Changes made to content is not very functional. 3. Changing content is (sometimes) annoyingly hard. To solve these problems, I looked into the very functional world of Haskell and found something called Functional reactive programming (FRP)[1][2] which has been used to solve problem 2 in gui programming for Haskell. To be able to program FRP, the datatype arrow was created (or maybe the other way around), and this is what Hafni uses. I wont go into detail here since it is not very easy to explain in a short mail, and there are a lot of resources out there on the subject (see the links). To be honest, when I first started programming on Hafni, I didn't know that there existed other swing wrappers for java (I guess I also wanted to try this myself, which meant that I didn't really search it out), but since they do exist, lets compare Hafni to the two I have seen on this mailing list: seesaw [3] and GUIFTW [4]. 1. Hafni is strictly a swing wrapper and does not claim to be anything else. Seesaw - aims to provide a ui library, It happens to be built on Swing. GUIFTW - It's not tied to any GUI toolkit but instead front-ends for each can be written easily. 2. Hafni has facilities, but is not really interested in exactly how components look. Seesaw - Doesn't really express an opinion about this, but seems to have a lot of facilities for making components look a certain way. GUIFTW - Style it in a CSS fashion 3. When events happen, Hafni uses the Event and arrow datatypes to make things happen while both seesaw and GUIFTW uses something that looks like the standard java event function(s). It should be noted that Hafni event/arrows behaves exactly like corresponding for seesaw and GUIFTW if no changes is made to content. The reason of 2 (which, in a way, leads to 3) is that when I wrote swing code manually, the parts that I were most annoyed with weren't to make things look as I wanted them, it was changing them. I haven't really looked into it exactly (or tried it), but it looks like seesaw and Hafni can be combined since seesaw deals directly with java objects (the config! function is especially interesting) [5]. I would like to end this mail with an example of Hafni. This example is the same as in the Hafni readme. (frame :content (comp-and-events (button :text *) :act (flow (output-arr this :text) (arr #(str % *)) (input-arr this :text))) :size 200 200 :dont_exit_on_close) As it's already explained in the readme, let's look at the most interesting part: (flow (output-arr this :text) (arr #(str % *)) (input-arr this :text)) This code snippet says that the current text of the button created with (button :text *) should flow to the function #(str % *) which adds a * to the text, which should flow to the text of that same button. The result of this is that when the button is pressed, the text of that button is changed as follows: * ** *** etc ... And finally, the link to Hafni: https://github.com/odyssomay/Hafni ___ I really hope that someone finds this project interesting, and at best even useful. ;) Questions, comments, ideas, critique? Jonathan 1. http://en.wikipedia.org/wiki/Functional_reactive_programming 2. http://www.haskell.org/haskellwiki/Functional_Reactive_Programming 3. https://github.com/daveray/seesaw 4.
Re: Radically simplified Emacs and SLIME setup
awesome, it works. many thanks :D i clearly need to read the slime manual On Thu, Jun 23, 2011 at 10:24 AM, Sam Ritchie sritchi...@gmail.com wrote: This should do the trick, though I'm not set up with jack-in to test: At the REPL, type comma (the character ,), then sayoonara. On Thu, Jun 23, 2011 at 11:20 AM, gaz jones gareth.e.jo...@gmail.com wrote: this is really great, thanks for putting this together. i have a (possibly daft) question -- is there a neat way to kill/restart the underlying process. i have looked for a *ahem* clojure-jack-off function or equivalent but couldnt find one in the source. i am just killing it from the terminal at the moment and re-running clojure-jack-in... is there a better way? slime-disconnect seems to leave the underlying process still running in list-processes. thanks again! gaz On Fri, Jun 17, 2011 at 3:35 PM, Jeff Dik s45...@gmail.com wrote: Mark, I got this same error when I copied and pasted the clojure-jack-in function from gmail. I had to remove newlines from (search-backward slime-load-hook) and (slime-connect localhost clojure-swank-port) Hope that helps, Jeff On Sun, Jun 12, 2011 at 8:50 PM, Mark Engelberg mark.engelb...@gmail.com wrote: error in process filter: Search failed: slime-load-hook On Sun, Jun 12, 2011 at 4:51 PM, Phil Hagelberg p...@hagelb.org wrote: On Jun 12, 10:58 am, Mark Engelberg mark.engelb...@gmail.com wrote: I take that back (I had edited the wrong file, which wasn't the one my emacs was using). I get the error Not enough arguments for format string. Oops; I forgot to mention it also needs this: (defvar clojure-swank-command lein jack-in %s ) to replace the old clojure-swank-command defvar. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 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 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 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 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
Can the namespace portion of a symbol contain slashes?
user (name 'a/b/c) c user (namespace 'a/b/c) a/b Is this intentional? I would have expected a/b/c to be rejected as a symbol name since we use slashes to separate namespace from name and conventionally use . to indicate hierarchy in namespace names. // Ben -- 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
Workers
Hi there, I'm playing with a little problem (calculating pi) that is trivially parallelizable in that I can easily break the calculation up into a bunch of chunks, send them off to workers and gather the results back together. The one additional requirement I have is that I'd like the process to be cancelable. I was wondering how others would go about doing this, especially in pure Clojure, i.e. without the help of any libraries. Here are some ideas I've had: * Each piece of work is a future which sends its result to an agent that accumulates the final result. This works, but to cancel the work, I have to keep the futures around and call (future-cancel) on each. This seems to cause a noticeable lag in the time it takes to cancel. Also, there doesn't seem to be a good way to cancel the results that are queued to the accumulator agent. Maybe I should just accumulate in an atom. * Create a pool of agents that block on a shared work queue. Then to cancel, I can just clear the queue. This seems like an abuse of agents, treating them as threads rather than a data structure with asynchronous update semantics. * Use the Work library (https://github.com/getwoven/work). Seems straightforward enough, but I'm interested in learning about what I can do with Clojure out of the box. * Use Lamina (https://github.com/ztellman/lamina). Same story as Work. A side note: isn't it interesting that both Work and Lamina have exactly the same number of github watchers (87) and forks (11). Weird. Thoughts? Thanks! 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
Re: getMethods
I have found a function to get the methods of the classes in the book The Joy of Clojure, and I would like to use it in REPL. Instead of java.awt.Frame I would like to specify the library that I want writing something like (methods any.library). Which is the way to get it? (for [method (seq (.getMethods java.awt.Frame)) :let [method-name (.getName method)]] method-name) You can do the above like this: (map #(.getName %) (.getMethods java.awt.Frame)) And to turn it into a function, you just do this: (defn class-methods [class-name] (map #(.getName %) (.getMethods class-name))) You might also want to look at clojure.reflect. The API results are data, and can easily be mapped/filtered/etc. Stuart Halloway Clojure/core http://clojure.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Radically simplified Emacs and SLIME setup
Sam Ritchie sritchi...@gmail.com writes: This should do the trick, though I'm not set up with jack-in to test: At the REPL, type comma (the character ,), then sayoonara. You can also just kill the *swank* buffer. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Generating API docs for clojure 1.3 projects
Shantanu Kumar kumar.shant...@gmail.com writes: Hi! Autodoc is superb! However having run into dependency issues with Autodoc myself, I think it would be cool if you can specify Clojure and Contrib JARs as only dev-dependencies so that they don't clash with the ones the user depends on too. Just an idea. I've tried that, but then I get --8---cut here---start-8--- Exception in thread main java.lang.UnsupportedOperationException: Cannot recur across try, compiling:(clojure/contrib/find_namespaces.clj:61) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6357) ... Caused by: java.lang.UnsupportedOperationException: Cannot recur across try at clojure.lang.Compiler$RecurExpr$Parser.parse(Compiler.java:6045) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6350) ... 85 more Compilation failed. --8---cut here---end---8--- when running lein jar and lein compile in the autodoc project. Bye, Tassilo -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can the namespace portion of a symbol contain slashes?
On Thu, Jun 23, 2011 at 11:55 AM, B Smith-Mannschott bsmith.o...@gmail.com wrote: user (name 'a/b/c) c user (namespace 'a/b/c) a/b Is this intentional? I would have expected a/b/c to be rejected as a symbol name since we use slashes to separate namespace from name and conventionally use . to indicate hierarchy in namespace names. = (namespace (symbol a/b)) = (name (symbol a/b)) a/b Both the namespace and the name can contain slashes, but the normal reader behavior is that foo/bar/baz is interpreted as namespace up to the last slash and then name. Unless the symbol is just /, in which case the reader treats that as the name, with no namespace. (Necessary for a bare / to resolve, ordinarily, to the division function clojure.core//). You can get any desired symbol using the two-argument form of the symbol function, though. There's some ickiness here. For instance the one-argument form of symbol doesn't parse the same as the reader does: = (clojure.core// 42 2) 21 = (eval (list (symbol clojure.core//) 42 2)) #CompilerException java.lang.StringIndexOutOfBoundsException: String index out of range: 0 (NO_SOURCE_FILE:1) = (eval (list (symbol clojure.core /) 42 2)) 21 In fact, (symbol clojure.core//) produces a symbol with namespace clojure.core/ and name , the latter of which apparently leads to the rather obfuscatory error message above. Symbols whose names contain slashes don't work as vars -- another cryptic message, since the symbol's actually unqualified here: = (eval (list 'def (symbol foo/bar) 42)) #CompilerException java.lang.Exception: Can't refer to qualified var that doesn't exist (NO_SOURCE_FILE:1) And symbols whose namespaces contain slashes won't work as vars with AOT, if at all, since the namespace name ends up a class file name and slashes are path separator characters on every sane filesystem and thus cannot appear in file names. Moral of the story: try to avoid slashes in symbol names, except for the unqualified name of the division operator. :) But if you really for some reason need one it can be done, though the only apparent use for such a symbol is as a kind of auto-interning string rather than as a var name. You'd probably be better off using a keyword for such uses. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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
Conversion of one java example to clojure?
I have tried to translate an example of vaadin in java to clojure. But I get errors. This is the java code: Panel panel = new Panel(Split Panels Inside This Panel); HorizontalSplitPanel hsplit = new HorizontalSplitPanel(); panel.setContent(hsplit); Tree tree = new Tree(Menu, TreeExample.createTreeContent()); hsplit.setFirstComponent(tree); VerticalSplitPanel vsplit = new VerticalSplitPanel(); hsplit.setSecondComponent(vsplit); vsplit.addComponent(new Label(Here's the upper panel)); vsplit.addComponent(new Buton(Here's the lower panel)); And this the clojure code. Where I am doing wrong? (defn -init [this] (let [app this] (.setMainWindow this (doto (Window. Test application) (add (panel (doto (Panel. Split panels inside this panel) (.setContent hsplit))) (hsplit (doto (HorizontalSplitPanel.) (.setFirstComponent tree) (.setSecondComponent vsplit))) (tree Tree. Menu) (vsplit VerticalSplitPanel. (add (Label. upper panel) (Button. lower panel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can the namespace portion of a symbol contain slashes?
On Thu, Jun 23, 2011 at 18:48, Ken Wesson kwess...@gmail.com wrote: On Thu, Jun 23, 2011 at 11:55 AM, B Smith-Mannschott bsmith.o...@gmail.com wrote: user (name 'a/b/c) c user (namespace 'a/b/c) a/b Is this intentional? I would have expected a/b/c to be rejected as a symbol name since we use slashes to separate namespace from name and conventionally use . to indicate hierarchy in namespace names. = (namespace (symbol a/b)) = (name (symbol a/b)) a/b Both the namespace and the name can contain slashes, but the normal reader behavior is that foo/bar/baz is interpreted as namespace up to the last slash and then name. Unless the symbol is just /, in which case the reader treats that as the name, with no namespace. (Necessary for a bare / to resolve, ordinarily, to the division function clojure.core//). You can get any desired symbol using the two-argument form of the symbol function, though. There's some ickiness here. For instance the one-argument form of symbol doesn't parse the same as the reader does: = (clojure.core// 42 2) 21 = (eval (list (symbol clojure.core//) 42 2)) #CompilerException java.lang.StringIndexOutOfBoundsException: String index out of range: 0 (NO_SOURCE_FILE:1) = (eval (list (symbol clojure.core /) 42 2)) 21 In fact, (symbol clojure.core//) produces a symbol with namespace clojure.core/ and name , the latter of which apparently leads to the rather obfuscatory error message above. Symbols whose names contain slashes don't work as vars -- another cryptic message, since the symbol's actually unqualified here: = (eval (list 'def (symbol foo/bar) 42)) #CompilerException java.lang.Exception: Can't refer to qualified var that doesn't exist (NO_SOURCE_FILE:1) And symbols whose namespaces contain slashes won't work as vars with AOT, if at all, since the namespace name ends up a class file name and slashes are path separator characters on every sane filesystem and thus cannot appear in file names. Moral of the story: try to avoid slashes in symbol names, except for the unqualified name of the division operator. :) But if you really for some reason need one it can be done, though the only apparent use for such a symbol is as a kind of auto-interning string rather than as a var name. You'd probably be better off using a keyword for such uses. Thanks! My question probably should have been: is it intentional that the Clojure reader accepts symbol names containing more than one slash, producing a namespace portion of the symbol containing slashes in its name? I've been reading through LispReader.java and porting bits of it to Clojure TDD-style as a finger exercise. That's how such questions arise. // ben -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Conversion of one java example to clojure?
What is the Java source for setting up the Window object? Ambrose On Fri, Jun 24, 2011 at 1:24 AM, Antonio Recio amdx6...@gmail.com wrote: I have tried to translate an example of vaadin in java to clojure. But I get errors. This is the java code: Panel panel = new Panel(Split Panels Inside This Panel); HorizontalSplitPanel hsplit = new HorizontalSplitPanel(); panel.setContent(hsplit); Tree tree = new Tree(Menu, TreeExample.createTreeContent()); hsplit.setFirstComponent(tree); VerticalSplitPanel vsplit = new VerticalSplitPanel(); hsplit.setSecondComponent(vsplit); vsplit.addComponent(new Label(Here's the upper panel)); vsplit.addComponent(new Buton(Here's the lower panel)); And this the clojure code. Where I am doing wrong? (defn -init [this] (let [app this] (.setMainWindow this (doto (Window. Test application) (add (panel (doto (Panel. Split panels inside this panel) (.setContent hsplit))) (hsplit (doto (HorizontalSplitPanel.) (.setFirstComponent tree) (.setSecondComponent vsplit))) (tree Tree. Menu) (vsplit VerticalSplitPanel. (add (Label. upper panel) (Button. lower panel -- 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 post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can the namespace portion of a symbol contain slashes?
My question probably should have been: is it intentional that the Clojure reader accepts symbol names containing more than one slash, producing a namespace portion of the symbol containing slashes in its name? The docs (http://clojure.org/reader) are specific: '/' has special meaning, it can be used once in the middle of a symbol to separate the namespace from the name, e.g. my-namespace/foo. '/' by itself names the division function. Stu Stuart Halloway Clojure/core http://clojure.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can the namespace portion of a symbol contain slashes?
On Thu, Jun 23, 2011 at 10:40 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: The docs (http://clojure.org/reader) are specific: '/' has special meaning, it can be used once in the middle of a symbol to separate the namespace from the name, e.g. my-namespace/foo. '/' by itself names the division function. Specific perhaps, but incomplete. The docs don't provide enough information to determine the validity or meaning or 'a/b/c.d for example. The docs say what '/ means (by itself) and what 'a/b means (used once - we'll put aside the imprecision of in the middle of a symbol) but not what used more than once means. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can the namespace portion of a symbol contain slashes?
On Thu, Jun 23, 2011 at 1:48 PM, Sean Corfield seancorfi...@gmail.com wrote: The docs say what '/ means (by itself) and what 'a/b means (used once - we'll put aside the imprecision of in the middle of a symbol) I think that's fairly clear: that the portions of the symbol to each side of the / are non-empty. In the middle as opposed to at one end or the other. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Conversion of one java example to clojure?
Does Window's add() method take multiple arguments? It looks like you're passing 4 arguments to it. Also (tree Tree. Menu) should be (tree (Tree. Menu)) Same with (vsplit VerticalSplitPanel. (add (Label. upper panel) (Button. lower panel Could you post the full source? Looks like you're using some helper functions like tree and vsplit and panel. Ambrose On Fri, Jun 24, 2011 at 2:19 AM, Antonio Recio amdx6...@gmail.com wrote: There are not window in the java code, anyway I have added it in the clojure code (could be deleted). The window java code could be something like this: setMainWindow(new Window(Test application)); -- 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 post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Conversion of one java example to clojure?
There are not window in the java code, anyway I have added it in the clojure code (could be deleted). The window java code could be something like this: setMainWindow(new Window(Test application)); -- 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
[ANN] Clojure 1.3 Beta 1
Clojure 1.3 Beta 1 is now available at http://clojure.org/downloads All of you that were waiting for the official beta, now's your chance to start using it! We look forward to your feedback. Here are the list of changes: 0 Changes from 1.3 Alpha 7 to 1.3 Beta 1 1 Changes from 1.3 Alpha 7 to 1.3 Alpha 8 2 Changes from 1.3 Alpha 6 to 1.3 Alpha 7 3 Changes from 1.3 Alpha 5 to 1.3 Alpha 6 4 Changes from 1.3 Alpha 4 to 1.3 Alpha 5 5 Changes from 1.3 Alpha 3 to 1.3 Alpha 4 6 Changes from 1.3 Alpha 2 to 1.3 Alpha 3 7 Changes from 1.3 Alpha 1 to 1.3 Alpha 2 8 Changes from 1.2 to 1.3 Alpha 1 9 About Alpha Releases Issue Tracking: http://dev.clojure.org/jira = 0 Changes from 1.3 Alpha 8 to 1.3 Beta 1 (06/21/2011) * Fix weak hold-unto-head problem in partition-by (CLJ-769) * Protocol's method cache falls back to using a map when shift-mask table won't work (CLJ-801) = 1 Changes from 1.3 Alpha 7 to 1.3 Alpha 8 (05/27/2011) * improvements to print/read for defrecords/deftypes (CLJ-800, CLJ-794) * numeric fixes (CLJ-795, CLJ-802) * fix compiler handling of recur mismatch (CLJ-671) * improved method resolution (CLJ-789) * allow record fields that collide with method names = 2 Changes from 1.3 Alpha 6 to 1.3 Alpha 7 (05/13/2011) * print/read syntax for defrecords (CLJ-374) * several primitive math improvements: (CLJ-184, CLJ-784, CLJ-690, CLJ-782) * case now handles hash collisions (CLJ-426) = 3 Changes from 1.3 Alpha 5 to 1.3 Alpha 6 (03/11/2011) * improved startup time * several holding onto head fixes (CLJ-708) * internal keyword map uses weak refs * fix perf on some numeric overloads (CLJ-380) * detect and report cyclic load dependencies (CLJ-8) = 4 Changes from 1.3 Alpha 4 to 1.3 Alpha 5 (01/14/2011) * pprint respects *print-length* * into-array now coerces numeric types * Java's line.separator property for newline * compilation and deployment via Maven = 5 Changes from 1.3 Alpha 3 to 1.3 Alpha 4 (12/12/2010) * normalized unchecked-* fn names * added *unchecked-math* support * fixes to binding conveyance (and *agent*) = 6 Changes from 1.3 Alpha 2 to 1.3 Alpha 3 (11/05/2010) * fixed filter performance issue introduced in 1.3A2 * with-redefs macro (useful for stubbing) * print-table = 7 Changes from 1.3 Alpha 1 to 1.3 Alpha 2 (10/10/2010) * code path for using vars is now *much* faster for the common case, and you must explicitly ask for :dynamic bindability * new: clojure.reflect/reflect http://dev.clojure.org/display/design/Reflection+API * new: clojure.data/diff = 8 Changes from 1.2 to 1.3 Alpha 1 (09/23/2010) * enhanced primitive support (http://dev.clojure.org/display/doc/Enhanced+Primitive+Support) * better exception reporting * ancillary namespaces no longer auto-load on startup: clojure.set, clojure.xml, clojure.zip = 9 About Alpha Releases 1.3 is the first release of Clojure that will include a series of alpha builds. We are adding these builds to support maven and leiningen users, who want a specific artifact that they can target (as opposed to building from master or moving-target snapshots). If you are the kind of person who used to track master by building from source, but no longer do so because you are using maven or leiningen, alpha releases are for you. -- Christopher Redinger Clojure/core http://clojure.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can the namespace portion of a symbol contain slashes?
On Thu, Jun 23, 2011 at 19:48, Sean Corfield seancorfi...@gmail.com wrote: On Thu, Jun 23, 2011 at 10:40 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: The docs (http://clojure.org/reader) are specific: '/' has special meaning, it can be used once in the middle of a symbol to separate the namespace from the name, e.g. my-namespace/foo. '/' by itself names the division function. Specific perhaps, but incomplete. The docs don't provide enough information to determine the validity or meaning or 'a/b/c.d for example. The docs say what '/ means (by itself) and what 'a/b means (used once - we'll put aside the imprecision of in the middle of a symbol) but not what used more than once means. On Thu, Jun 23, 2011 at 20:20, Ken Wesson kwess...@gmail.com wrote: On Thu, Jun 23, 2011 at 1:48 PM, Sean Corfield seancorfi...@gmail.com wrote: The docs say what '/ means (by itself) and what 'a/b means (used once - we'll put aside the imprecision of in the middle of a symbol) I think that's fairly clear: that the portions of the symbol to each side of the / are non-empty. In the middle as opposed to at one end or the other. I disagree. It's not at all clear from the above description how the reader will interpret a/b/c: (1) namespace: a/b name: c (2) namespace: a name: b/c (3) throw an exception since the string violates it can be used once. The reader as implemented behaves as (1), though it's not clear from the documentation why this would be preferred above (2) or (3). // Ben -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Conversion of one java example to clojure?
It looks like you may also be thinking that you are creating local bindings in the 'add' call, but you actually need to create those bindings in a let. Also,'app' is bound to 'this' but never used. I think something like this may be closer to what you are trying to do: (defn -init [this] (let [tree (Tree. Menu) vsplit (doto (VerticalSplitPanel.) (.add (Label. upper panel)) (.add (Button. lower panel))) hsplit (doto (HorizontalSplitPanel.) (.setFirstComponent tree) (.setSecondComponent vsplit)) panel (doto (Panel. Split panels inside this panel) (.setContent hsplit)) window (Window. Test application)] (do (.add window panel) (.setMainWindow this window On Thu, Jun 23, 2011 at 2:27 PM, Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com wrote: Does Window's add() method take multiple arguments? It looks like you're passing 4 arguments to it. Also (tree Tree. Menu) should be (tree (Tree. Menu)) Same with (vsplit VerticalSplitPanel. (add (Label. upper panel) (Button. lower panel Could you post the full source? Looks like you're using some helper functions like tree and vsplit and panel. Ambrose On Fri, Jun 24, 2011 at 2:19 AM, Antonio Recio amdx6...@gmail.com wrote: There are not window in the java code, anyway I have added it in the clojure code (could be deleted). The window java code could be something like this: setMainWindow(new Window(Test application)); -- 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 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 post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can the namespace portion of a symbol contain slashes?
On Thu, Jun 23, 2011 at 2:47 PM, B Smith-Mannschott bsmith.o...@gmail.com wrote: On Thu, Jun 23, 2011 at 20:20, Ken Wesson kwess...@gmail.com wrote: On Thu, Jun 23, 2011 at 1:48 PM, Sean Corfield seancorfi...@gmail.com wrote: The docs say what '/ means (by itself) and what 'a/b means (used once - we'll put aside the imprecision of in the middle of a symbol) I think that's fairly clear: that the portions of the symbol to each side of the / are non-empty. In the middle as opposed to at one end or the other. I disagree. It's not at all clear from the above description how the reader will interpret a/b/c I wasn't talking about that; just about the alleged imprecision of in the middle. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can the namespace portion of a symbol contain slashes?
On Thu, Jun 23, 2011 at 10:40 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: The docs (http://clojure.org/reader) are specific: '/' has special meaning, it can be used once in the middle of a symbol to separate the namespace from the name, e.g. my-namespace/foo. '/' by itself names the division function. Specific perhaps, but incomplete. The docs don't provide enough information to determine the validity or meaning or 'a/b/c.d for example. The docs say what '/ means (by itself) and what 'a/b means (used once - we'll put aside the imprecision of in the middle of a symbol) but not what used more than once means. On Thu, Jun 23, 2011 at 20:20, Ken Wesson kwess...@gmail.com wrote: On Thu, Jun 23, 2011 at 1:48 PM, Sean Corfield seancorfi...@gmail.com wrote: The docs say what '/ means (by itself) and what 'a/b means (used once - we'll put aside the imprecision of in the middle of a symbol) I think that's fairly clear: that the portions of the symbol to each side of the / are non-empty. In the middle as opposed to at one end or the other. I disagree. It's not at all clear from the above description how the reader will interpret a/b/c: (1) namespace: a/b name: c (2) namespace: a name: b/c (3) throw an exception since the string violates it can be used once. The reader as implemented behaves as (1), though it's not clear from the documentation why this would be preferred above (2) or (3). // Ben The docs at clojure.org do not aspire to enumerate every possible scenario, especially regarding the things that Clojure does *not* do. If the docs don't say you can do this, then you should assume you can't (or at least shouldn't). Stu Stuart Halloway Clojure/core http://clojure.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can the namespace portion of a symbol contain slashes?
On Thu, Jun 23, 2011 at 11:20 AM, Ken Wesson kwess...@gmail.com wrote: On Thu, Jun 23, 2011 at 1:48 PM, Sean Corfield seancorfi...@gmail.com wrote: The docs say what '/ means (by itself) and what 'a/b means (used once - we'll put aside the imprecision of in the middle of a symbol) I think that's fairly clear: that the portions of the symbol to each side of the / are non-empty. In the middle as opposed to at one end or the other. So which of the two / is in the middle of 'abc/d/e then? :) -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Conversion of one java example to clojure?
Before I have forgotten to post the source of the function add (https://groups.google.com/d/topic/clojure/N1wmlOrGYj0/discussion): (defn add [composite components] Avoid repetition of .addComponent Instead of (doto (Window. \foo\) (.addComponent (Label. \bar\)) (.addComponent (Button. \button\))) you can use (doto (Window. \foo\) (add (Label. \bar\) (Button. \button\))) (doseq [component components] (.addComponent composite component))) I would like to post a complete example of vaadin in java (http://demo.vaadin.com/sampler/#SplitPanelBasic) and the translation in clojure that I have done, and to know your opinion. ;; JAVA : import com.vaadin.terminal.Sizeable; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.CheckBox; import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalSplitPanel; @SuppressWarnings(serial) public class SplitPanelBasicExample extends VerticalLayout { public static final String brownFox = The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. ; public SplitPanelBasicExample() { // First a vertical SplitPanel final VerticalSplitPanel vert = new VerticalSplitPanel(); vert.setHeight(450px); vert.setWidth(100%); vert.setSplitPosition(150, Sizeable.UNITS_PIXELS); addComponent(vert); // add a label to the upper area vert.addComponent(new Label(brownFox)); // Add a horizontal SplitPanel to the lower area final HorizontalSplitPanel horiz = new HorizontalSplitPanel(); horiz.setSplitPosition(50); // percent vert.addComponent(horiz); // left component: horiz.addComponent(new Label(brownFox)); // right component: horiz.addComponent(new Label(brownFox)); // Lock toggle button CheckBox toggleLocked = new CheckBox(Splits locked, new Button.ClickListener() { // inline click.listener public void buttonClick(ClickEvent event) { vert.setLocked(event.getButton().booleanValue()); horiz.setLocked(event.getButton().booleanValue()); } }); toggleLocked.setImmediate(true); addComponent(toggleLocked); } } ;; CLOJURE : (ns project.vapp (:gen-class :extends com.vaadin.Application :name example.VApp :init cjinit) (:import (com.vaadin.ui CheckBox HorizontalSplitPanel Label VerticalLayout VerticalSplitPanel) (com.vaadin.terminal Sizeable))) (defn -cjinit [] [[] (ref {})]) (defn add [composite components] Avoid repetition of .addComponent Instead of (doto (Window. \foo\) (.addComponent (Label. \bar\)) (.addComponent (Button. \button\))) you can use (doto (Window. \foo\) (add (Label. \bar\) (Button. \button\))) (doseq [component components] (.addComponent composite component))) (def brownFox (fn [] The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. )) (defn -init [this] (let [app this] (vert (doto (VerticalSplitPanel.) (.setHeight 450px) (.setWidht 100%) (.setSplitPosition (150 Sizeable.UNITS_PIXELS)) (add (Label. brownFox) (horiz (add vert) (horiz (doto (HorizontalSplitPanel.) (.setSplitPosition 50) (add (Label. brownFox)) ; Left component (add (Label. brownFox ; Right component (toggleLocked (doto (CheckBox. Split locked) (.addListener (proxy [com.vaadin.ui.Button$ClickListener] [] (buttonClick [event] (.setLocked(- (event.getButton) (.booleanValue)) vert) (.setLocked(- (event.getButton) (.booleanValue)) horiz (.setImmediate true))) (add toggleLocked))) -- You received this message because you
Re: Can the namespace portion of a symbol contain slashes?
On Thu, Jun 23, 2011 at 3:29 PM, Sean Corfield seancorfi...@gmail.com wrote: On Thu, Jun 23, 2011 at 11:20 AM, Ken Wesson kwess...@gmail.com wrote: On Thu, Jun 23, 2011 at 1:48 PM, Sean Corfield seancorfi...@gmail.com wrote: The docs say what '/ means (by itself) and what 'a/b means (used once - we'll put aside the imprecision of in the middle of a symbol) I think that's fairly clear: that the portions of the symbol to each side of the / are non-empty. In the middle as opposed to at one end or the other. So which of the two / is in the middle of 'abc/d/e then? :) Both of them. But the context of that phrase originally was used once in the middle of a symbol, so it was referring to symbols with only one /. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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
Complement to clojure survey
As suggested by Chas Emerick here: http://cemerick.com/2011/06/15/the-2011-state-of-clojure-survey-is-open/#comments I've created the following survey: https://spreadsheets.google.com/spreadsheet/viewform?formkey=dFFJTTZWT2lXR1N1dTJTWk5mdjZXZlE6MQ -- 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
Freelance Friday @MadLab Every Friday!
Title: Freelance Friday in July Location: MadLab Description: Bring together the Manchester freelance community. Start Time: 10:00 Date: Every Friday End Time: 17:00 Are you free on Fridays? …. if you are come along to our Freelance Friday. The doors are open to anyone who is looking for a space to work, and to catch up with other freelancers in the area. Co-working and freelancing is the future, so why not come along to MadLab. The fee is a flat £5 all day – your money gets you open wifi, unlimited tea and coffee, and for those eager beavers a breakfast buffet of crumpets, croissants and even some five-a-day fruit. You can get dinner in any of the local eateries (Common have really nice burgers), bring a pack lunch, or heat up something in our renovated kitchen. Make us your Wi-Fi hotspot! Hope to see you there! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Complement to clojure survey
On 06/23/2011 04:22 PM, Milton Silva wrote: As suggested by Chas Emerick here: http://cemerick.com/2011/06/15/the-2011-state-of-clojure-survey-is-open/#comments I've created the following survey: https://spreadsheets.google.com/spreadsheet/viewform?formkey=dFFJTTZWT2lXR1N1dTJTWk5mdjZXZlE6MQ Can you make the build tools a checkbox list? I use more than one :) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Complement to clojure survey
done ;) btw, why do you find it useful to use more than one? or is it a necessity? On Jun 23, 9:44 pm, Aaron Bedra aaron.be...@gmail.com wrote: On 06/23/2011 04:22 PM, Milton Silva wrote: As suggested by Chas Emerick here: http://cemerick.com/2011/06/15/the-2011-state-of-clojure-survey-is-op... I've created the following survey: https://spreadsheets.google.com/spreadsheet/viewform?formkey=dFFJTTZW... Can you make the build tools a checkbox list? I use more than one :) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Complement to clojure survey
I start with Leiningen because it is simple. I end up on Maven when Leiningen can't provide what I need. This list includes but is not limited to: * Projects that have multiple local project dependencies, all in the build chain * Projects that have native (JNI) code that need to be built and are a dependency of the project * Projects where Leiningen just happens to fall down for some unexplained reason Please don't read this as Leiningen sucks. I love Leiningen and it IS my default. There are just some things that crop up every now and again and since I am too lazy to fix them myself, I suffer the consequences (Maven). Cheers, Aaron On 06/23/2011 05:06 PM, Milton Silva wrote: done ;) btw, why do you find it useful to use more than one? or is it a necessity? On Jun 23, 9:44 pm, Aaron Bedraaaron.be...@gmail.com wrote: On 06/23/2011 04:22 PM, Milton Silva wrote: As suggested by Chas Emerick here: http://cemerick.com/2011/06/15/the-2011-state-of-clojure-survey-is-op... I've created the following survey: https://spreadsheets.google.com/spreadsheet/viewform?formkey=dFFJTTZW... Can you make the build tools a checkbox list? I use more than one :) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Complement to clojure survey
Aaron Bedra aaron.be...@gmail.com writes: I start with Leiningen because it is simple. I end up on Maven when Leiningen can't provide what I need. This list includes but is not limited to: * Projects that have multiple local project dependencies, all in the build chain Have you looked into checkout dependencies? I'd be interested in hearing more about this particular use case if it's something that checkout deps don't address. * Projects that have native (JNI) code that need to be built and are a dependency of the project Hah; I have been looking for people to test the new native deps support in Leiningen for weeks. Where have you been? =) * Projects where Leiningen just happens to fall down for some unexplained reason It would be great to see bug reports for these cases if it's not too much trouble. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
setting the classpath in cake+slime (was Re: Screencast: Clojure + Emacs + slime + swank + cake + Overtone)
I wrote (below) about being unable to get load to work from the slime repl after completing the emacs/cake/swank/slime setup that Sam presented in helpful video. Now I think it's a more general problem of not setting the classpath correctly. If I try to :use something in the ns form in a file, for which I have a .clj file in the same directory as the core.clj that cake created, then when I evaluate the buffer in emacs the required file is not found. How and where do I set up the classpath so that this will work (using emacs/cake/swank/slime)? If possible I'd like to set it up so that it always finds anything anywhere in the cake project directory, including .clj files in src/. Thanks, -Lee On Jun 21, 11:09 pm, Lee Spector lspec...@hampshire.edu wrote: On Jun 16, 2011, at 11:16 AM, Sam Aaron wrote: I just finished making a screencast primarily for new Overtone users on how to get set up with Emacs as a primary editor: http://vimeo.com/25190186 - I also can't get (load core), or any variant that I could think of, when typed in the REPL to find the file. When I look at the classpath with (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))) I see some of my project's files there, so it knows about the project, but it doesn't find my file in the src directory that cake created. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can the namespace portion of a symbol contain slashes?
On Thu, Jun 23, 2011 at 1:04 PM, Ken Wesson kwess...@gmail.com wrote: Both of them. But the context of that phrase originally was used once in the middle of a symbol, so it was referring to symbols with only one /. Which is the whole point: the docs ascribe meaning to a/b and to / but do not ascribe meaning to a/b/c So the question still remains: is a/b/c supposed to be a valid symbol and, if so, is it a/b and c or is it a and b/c? Current behavior suggests a/b and c but it's not clear whether that's by design or thru an accident of implementation. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Complement to clojure survey
On 06/23/2011 05:56 PM, Phil Hagelberg wrote: Aaron Bedraaaron.be...@gmail.com writes: I start with Leiningen because it is simple. I end up on Maven when Leiningen can't provide what I need. This list includes but is not limited to: * Projects that have multiple local project dependencies, all in the build chain Have you looked into checkout dependencies? I'd be interested in hearing more about this particular use case if it's something that checkout deps don't address. I haven't looked at that quite yet. * Projects that have native (JNI) code that need to be built and are a dependency of the project Hah; I have been looking for people to test the new native deps support in Leiningen for weeks. Where have you been? =) My native deps problem is the one that I replied to on the list when you asked for help. It is not just including a native dep, but actually building it. * Projects where Leiningen just happens to fall down for some unexplained reason It would be great to see bug reports for these cases if it's not too much trouble. Yes, we need to start sending stuff in. The only problem is recreating the bug in a way where we can share the code. It is often times some strange repl issue that doesn't exist until we are multiple layers deep in a project. There haven't really been too many random lein bugs in quite a while though. Most of them had to do with repl but we don't use that anymore. I'll try to be more diligent with submitting reports :) Aaron -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Conversion of one java example to clojure?
Why is brownFox a function instead of a string constant? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Complement to clojure survey
Aaron Bedra aaron.be...@gmail.com writes: Hah; I have been looking for people to test the new native deps support in Leiningen for weeks. Where have you been? =) My native deps problem is the one that I replied to on the list when you asked for help. It is not just including a native dep, but actually building it. Oh, I see; yes that's different. I'm interested in discussing that once Leiningen 1.6 is released. I'd love to get some requirements as there are very few open source projects that actually use native code and I have never been in that position myself. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Complement to clojure survey
On 06/23/2011 11:25 PM, Phil Hagelberg wrote: Aaron Bedraaaron.be...@gmail.com writes: Hah; I have been looking for people to test the new native deps support in Leiningen for weeks. Where have you been? =) My native deps problem is the one that I replied to on the list when you asked for help. It is not just including a native dep, but actually building it. Oh, I see; yes that's different. I'm interested in discussing that once Leiningen 1.6 is released. I'd love to get some requirements as there are very few open source projects that actually use native code and I have never been in that position myself. -Phil I'm happy to run down the scenario that we've had and help put something together -- Cheers, Aaron Bedra -- Clojure/core http://clojure.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can the namespace portion of a symbol contain slashes?
On Thu, Jun 23, 2011 at 7:59 PM, Sean Corfield seancorfi...@gmail.com wrote: On Thu, Jun 23, 2011 at 1:04 PM, Ken Wesson kwess...@gmail.com wrote: Both of them. But the context of that phrase originally was used once in the middle of a symbol, so it was referring to symbols with only one /. Which is the whole point: the docs ascribe meaning to a/b and to / but do not ascribe meaning to a/b/c That was your point. I never disputed it. I only said there was nothing particularly ambiguous about the specific phrase in the middle of. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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