Re: restarts
On Thursday, June 19, 2014 11:05:07 PM UTC+2, Thomas Heller wrote: Excuse my ignorance of not knowing anything about CL and restarts but I needed something like retry a while back. Restarts in CL are a different beast. Take a look at e.g. http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html Best, stefan -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
leiningen project hooks
I've been struggling with leiningen project hooks as I believe that I need them for my current project. I am writing an manual with code examples, using a literate programming technology. The main source is in asciidoc, but I can untangle these to produce valid clojure, which I can then evaluate and test. To do this, however, I need to run an external process to generate the source -- i.e. the Clojure files which are not really source in this case, before I try to load them and test the functions in them. In Maven, I can do this with the exec plugin by attaching to the initialize phase. I thought to try leiningen hooks but as far as I can see this is only possible within a plugin; so I have tried this... (defproject take-wing 0.1.0-SNAPSHOT :dependencies [[org.clojure/clojure 1.6.0] [uk.org.russet/tawny-owl 1.1.1-SNAPSHOT]] :hooks [take.build.gensource] ) where take.build.gensource is defined in the src directory of the project (most of the rest of this directory will be generated). Error: cannot resolve take.build.gensource/activate hook Error: cannot resolve take.build.gensource/activate hook The take/build/gensource.clj file exists and it has an activate function. I am guessing that this is failing because leiningen is not looking in the project source-path, only it's own classpath. I'm a bit reticient to write a leiningen plugin for this as a) it would be entirely specific to this project and b) it would make the build more complex (AFAIK I'd have to do a pre-build for the plugin, then another for the actual project) and c) is a pain for anyone else. So, should hooks work under these circumstances? Or must I go the plugin route? 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: macro - unquote
http://blog.8thlight.com/colin-jones/2012/05/22/quoting-without-confusion.html On Thursday, June 19, 2014 12:22:36 PM UTC+3, sorin cristea wrote: hi all, related to macro definition, what are the differences between*[** ' ]* char and *[ ` ]* char ? thanks. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: restarts
Don't want to get into a debate about whether something is a good idea or not, but that beast seems to go against clojures data-all-the-things. In their example, you'd move a side effect into an otherwise pure function of taking text and turning it into data. Maybe a little different solution, that uses data instead of throw (defrecord LogEntry [valid? data error]) (defn parse-log-entry [text] (if (looks-good? text) (-LogEntry true (actually-parse text) nil) (-LogEntry false nil (turn-into-error-message text (defn explode-on-invalid-entries! [log] (let [errors (- log (remove :valid?) (map :error) (doall))] (when (seq errors) (throw (ex-info parse failed with invalid entries {:errors errors}))) log)) (defn parse-log [log] (- (line-seq log) (map parse-log-entry) ;; remove invalid entries (filter :valid?) (map :data) ;; or (replace invalid values with default) (map (fn [{:keys [valid? data] :as it}] (if valid? data default-data))) ;; or bail (explode-on-invalid-entries!) )) Just let parse-log-entry return whether the entry was ok or not. So we can handle it outside. Might just return nil on invalid entries, but that loses information. Avoid Exceptions whereever possible. But again, I know nothing about CL so it might be a good idea to use restarts. IMHO its not a good idea in clojure, especially coupled with lazy-seqs. But we are getting off-topic ... Regards, /thomas On Fri, Jun 20, 2014 at 9:04 AM, Stefan Kamphausen ska2...@gmail.com wrote: On Thursday, June 19, 2014 11:05:07 PM UTC+2, Thomas Heller wrote: Excuse my ignorance of not knowing anything about CL and restarts but I needed something like retry a while back. Restarts in CL are a different beast. Take a look at e.g. http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html Best, stefan -- 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 a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/lfWhAagj1-Q/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Record and hash-map memory usage
Hi, I am trying to understand the difference in memory usage between a defrecord and a hashmap in Clojure 1.6. (I am a Clojure and a Java newbie). I've read in Joy of Clojure that a record consumes less memory than a hash-map. I've also read in prismatic eng-practices data representation guide https://github.com/Prismatic/eng-practices/blob/master/clojure/20130926-data-representation.md that the memory usage of a record is compact. Is there any data to highlight these statements? I tried using memory-measurer https://code.google.com/p/memory-measurer/ to figure that out but I was unsuccessful in finding the difference. Thanks. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure equivalent of 3-level enumeration in Ruby?
On 18/06/2014 17:07, Gary Trakhman wrote: Try http://clojuredocs.org/clojure_core/clojure.core/for I couldn't get anywhere near what was so easy in Ruby. Nested enumeration seems difficult in Clojure. gvim -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure equivalent of 3-level enumeration in Ruby?
Care to explain? How does it get much simpler than: (for [x some-collection y x z y] z) On Fri, Jun 20, 2014 at 5:52 AM, gvim gvi...@gmail.com wrote: On 18/06/2014 17:07, Gary Trakhman wrote: Try http://clojuredocs.org/clojure_core/clojure.core/for I couldn't get anywhere near what was so easy in Ruby. Nested enumeration seems difficult in Clojure. gvim -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Best tools for profiling Clojure programs?
Hi all, What performance profiling instrument somebody can recommend for Clojure programs and corresponding documents, articles or tutorials. Thanks in advance. Sincerely, Ru -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure equivalent of 3-level enumeration in Ruby?
On 20/06/2014 13:38, Timothy Baldridge wrote: Care to explain? How does it get much simpler than: (for [x some-collection y x z y] z) Because it's 3 levels deep and requires substituting the vars back into maps to then create a returned map. Your for example doesn't emulate Ruby's each_with_index, as in the example, as far as I'm aware. I'm fairly new to Clojure so the obvious may not be so obvious to me yet :) gvim -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure equivalent of 3-level enumeration in Ruby?
On 20/06/14 15:11, gvim wrote: Because it's 3 levels deep and requires substituting the vars back into maps to then create a returned map. Your for example doesn't emulate Ruby's each_with_index, as in the example, as far as I'm aware. I'm fairly new to Clojure so the obvious may not be so obvious to me yet :) In that case destructuring http://blog.jayfields.com/2010/07/clojure-destructuring.html like in this example http://clojuredocs.org/clojure_core/clojure.core/for#example_618 and/or map-indexed http://clojuredocs.org/clojure_core/clojure.core/map-indexed could help. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure equivalent of 3-level enumeration in Ruby?
Rather than start with the code you are trying to duplicate, consider the data structure(s) that you have as input and the data structure you want to end up with. It's certainly possible to emulate the kind of nested loop structure you are asking about in Clojure, but most likely it's not how you'd structure the solution in the first place. For one, the Ruby example heavily depends on mutability, which is not as common in Clojure-land. But here's one rough sketch, just as a simple example: I might make personals and aspected vectors of keywords, and I'd end up doing something more like (def find-aspects [astro-data] (reduce #(update-in %1 [%2] (do-aspected-stuff ...)) {} personals)) With do-aspected-stuff being something like: (defn do-aspected-stuff [personal-key astro-data] (reduce #(if (= personal-key %2) %1 (calc-angles astro-data %1 %2)) {} aspected)) and so on and so forth with calc-angles doing its own looping thing with all the calculations you have to do (glossing over the rest as hopefully you get the picture at this point), and everything gets deposited in the hash-map at the very top of the chain at the end. Hope this helps. DD (2014/06/20 22:11), gvim wrote: On 20/06/2014 13:38, Timothy Baldridge wrote: Care to explain? How does it get much simpler than: (for [x some-collection y x z y] z) Because it's 3 levels deep and requires substituting the vars back into maps to then create a returned map. Your for example doesn't emulate Ruby's each_with_index, as in the example, as far as I'm aware. I'm fairly new to Clojure so the obvious may not be so obvious to me yet :) gvim -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure equivalent of 3-level enumeration in Ruby?
Sorry, the first example fn is confusing--I'd probably use assoc rather than update-in: (reduce #(assoc %1 %2 (do-aspected-stuff ...)) {} personals)) (2014/06/20 22:28), Dave Della Costa wrote: Rather than start with the code you are trying to duplicate, consider the data structure(s) that you have as input and the data structure you want to end up with. It's certainly possible to emulate the kind of nested loop structure you are asking about in Clojure, but most likely it's not how you'd structure the solution in the first place. For one, the Ruby example heavily depends on mutability, which is not as common in Clojure-land. But here's one rough sketch, just as a simple example: I might make personals and aspected vectors of keywords, and I'd end up doing something more like (def find-aspects [astro-data] (reduce #(update-in %1 [%2] (do-aspected-stuff ...)) {} personals)) With do-aspected-stuff being something like: (defn do-aspected-stuff [personal-key astro-data] (reduce #(if (= personal-key %2) %1 (calc-angles astro-data %1 %2)) {} aspected)) and so on and so forth with calc-angles doing its own looping thing with all the calculations you have to do (glossing over the rest as hopefully you get the picture at this point), and everything gets deposited in the hash-map at the very top of the chain at the end. Hope this helps. DD (2014/06/20 22:11), gvim wrote: On 20/06/2014 13:38, Timothy Baldridge wrote: Care to explain? How does it get much simpler than: (for [x some-collection y x z y] z) Because it's 3 levels deep and requires substituting the vars back into maps to then create a returned map. Your for example doesn't emulate Ruby's each_with_index, as in the example, as far as I'm aware. I'm fairly new to Clojure so the obvious may not be so obvious to me yet :) gvim -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure equivalent of 3-level enumeration in Ruby?
On 20/06/2014 14:28, Dave Della Costa wrote: Rather than start with the code you are trying to duplicate, consider the data structure(s) that you have as input and the data structure you want to end up with. It's certainly possible to emulate the kind of nested loop structure you are asking about in Clojure, but most likely it's not how you'd structure the solution in the first place. For one, the Ruby example heavily depends on mutability, which is not as common in Clojure-land. But here's one rough sketch, just as a simple example: I might make personals and aspected vectors of keywords, and I'd end up doing something more like (def find-aspects [astro-data] (reduce #(update-in %1 [%2] (do-aspected-stuff ...)) {} personals)) With do-aspected-stuff being something like: (defn do-aspected-stuff [personal-key astro-data] (reduce #(if (= personal-key %2) %1 (calc-angles astro-data %1 %2)) {} aspected)) and so on and so forth with calc-angles doing its own looping thing with all the calculations you have to do (glossing over the rest as hopefully you get the picture at this point), and everything gets deposited in the hash-map at the very top of the chain at the end. Hope this helps. DD Great, thanks. These are the kind of pointers I was looking for without expecting anyone to do the whole job :). Someone on IRC also mentioned prismatic/plumbing as possibly helpful. gvim -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Best tools for profiling Clojure programs?
I can speak to existence but not optimality :) I've use JProfiler, and my experience is that, just like debuggers work, so does this particular profiler. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure equivalent of 3-level enumeration in Ruby?
I don't think you need plumbing for this. On Friday, June 20, 2014, gvim gvi...@gmail.com wrote: On 20/06/2014 14:28, Dave Della Costa wrote: Rather than start with the code you are trying to duplicate, consider the data structure(s) that you have as input and the data structure you want to end up with. It's certainly possible to emulate the kind of nested loop structure you are asking about in Clojure, but most likely it's not how you'd structure the solution in the first place. For one, the Ruby example heavily depends on mutability, which is not as common in Clojure-land. But here's one rough sketch, just as a simple example: I might make personals and aspected vectors of keywords, and I'd end up doing something more like (def find-aspects [astro-data] (reduce #(update-in %1 [%2] (do-aspected-stuff ...)) {} personals)) With do-aspected-stuff being something like: (defn do-aspected-stuff [personal-key astro-data] (reduce #(if (= personal-key %2) %1 (calc-angles astro-data %1 %2)) {} aspected)) and so on and so forth with calc-angles doing its own looping thing with all the calculations you have to do (glossing over the rest as hopefully you get the picture at this point), and everything gets deposited in the hash-map at the very top of the chain at the end. Hope this helps. DD Great, thanks. These are the kind of pointers I was looking for without expecting anyone to do the whole job :). Someone on IRC also mentioned prismatic/plumbing as possibly helpful. gvim -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Workflow: cljx, cljsbuild tdd in one process
You can get some manner of memory pressure relief by using the G1GC (which lets the OS reclaim memory) and forcing GC's once in a while. Leiningen has 2 JVMs. In my ~/.emacs.d/init.el: (setenv LEIN_JVM_OPTS -XX:+UseG1GC) will catch the leiningen JVM. In my ~/.lein/profiles.clj :jvm-opts [-XX:+UseG1GC] will catch project JVMs. You can force a GC on all java processes with some variation of: ps axf | grep java | grep -v grep | awk '{print jmap -histo:live $1}' | sh This will help keep the footprint low at steady-state. On Fri, Jun 20, 2014 at 10:54 AM, Michal Till michal.t...@gmail.com wrote: Hello, Based on my previous experience with Ruby, JavaScript etc. I have set up my workflow in a way that it runs three different processes: lein cljx auto - translates the sources to clj and cljs lein cljsbuild auto dev - reads cljs output of ^^ and compiles it on every file change lein midje :autotest - runs tests on every file change Starting all these JVMs takes a considerable amount of time and my old macbook is frying. I feel that there must be a better way. For example in javascript's Gulp buildsystem I pipe all the sources form one compilaiton step to the other in one process, avoiding unreliable filesystem events etc. Is there a way this can be easily improved? Michal -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Workflow: cljx, cljsbuild tdd in one process
Hello, Based on my previous experience with Ruby, JavaScript etc. I have set up my workflow in a way that it runs three different processes: lein cljx auto - translates the sources to clj and cljs lein cljsbuild auto dev - reads cljs output of ^^ and compiles it on every file change lein midje :autotest - runs tests on every file change Starting all these JVMs takes a considerable amount of time and my old macbook is frying. I feel that there must be a better way. For example in javascript's Gulp buildsystem I pipe all the sources form one compilaiton step to the other in one process, avoiding unreliable filesystem events etc. Is there a way this can be easily improved? Michal -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Workflow: cljx, cljsbuild tdd in one process
There's also a Leiningen plugin called lein-pdo that lets you run tasks in parallel: https://github.com/Raynes/lein-pdo Example usage for cljx auto cljsbuild auto: https://github.com/DomKM/omelette/blob/master/project.clj#L59 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
How to know if an agent throw an exception?
Hi, When using send-off of an Agent, how to know if any exception is happened? Since AFAIK, agents are executed in different thread. Currently, I'm calling (agent-error) but nothing is logged. Maybe nothing went wrong but some how I'm sure something went wrong. Thank you. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
How to tackle this concurrency problem?
Hi, I have a ref that saves the ID of last processed event. Of course, I'm using Clojure STM facility. The problem now is I can't control the value of the ref. Due massive concurrency, it is updated and my logic is broken. How to guard, and really guard the update of that ref? Should I do (locking) ? Thanks for help and time. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
OOM problem with test.check
Hi all, I'm trying to use test.check to create random objects to test some serialisation code I'm having problems with. In the past, generative testing has worked really well for me for exactly this use case. However, I'm finding that I'm getting OutOfMemoryError when trying to test a lot of iterations: (defn object [size] (if (= 0 size) (gen/one-of [(gen/return nil) gen/boolean gen/string gen/keyword gen/nat]) (let [new-size (quot size 2) next (gen/resize new-size (gen/sized object))] (gen/one-of [(gen/return nil) gen/boolean gen/string gen/keyword (gen/vector next) (gen/map next next) (gen/fmap set (gen/vector next)) gen/nat] (def object-serializes (prop/for-all [v (gen/sized object)] (let [serialiser (ClojureSerialiser. {}) byte-stream (ByteArrayOutputStream.) data-stream (DataOutputStream. byte-stream) _ (.serialise serialiser data-stream v) bytes (.toByteArray byte-stream)] (= v (.deserialise serialiser (DataInputStream. (ByteArrayInputStream. bytes))) (check/quick-check 500 object-serializes) java.lang.OutOfMemoryError: Java heap space Dumping heap to java_pid9895.hprof ... Heap dump file created [1976236588 bytes in 35.110 secs] OutOfMemoryError Java heap space clojure.test.check.rose-tree/permutations/iter--43--47 (rose_tree.clj:71) Looking at the heap dump in MAT, it looks like something internal to test.check is holding onto the head of a sequence: clojure.lang.PersistentVector + clojure.test.check.generators$sequence$fn__109$fn__110$fn__111 | + clojure.test.check.generators$gen_bind$fn__149 I assume this is something I'm doing wrong, but I have no idea what. Can anyone suggest anything? Thanks, Colin -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to tackle this concurrency problem?
What do you mean by I can't control the value of the ref? Could you provide some code to show what you mean? - James On 20 June 2014 18:10, Hussein B. hubaghd...@gmail.com wrote: Hi, I have a ref that saves the ID of last processed event. Of course, I'm using Clojure STM facility. The problem now is I can't control the value of the ref. Due massive concurrency, it is updated and my logic is broken. How to guard, and really guard the update of that ref? Should I do (locking) ? Thanks for help and time. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to know if an agent throw an exception?
You should give it an error-handler: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/agent On Fri, Jun 20, 2014 at 12:46 PM, Hussein B. hubaghd...@gmail.com wrote: Hi, When using send-off of an Agent, how to know if any exception is happened? Since AFAIK, agents are executed in different thread. Currently, I'm calling (agent-error) but nothing is logged. Maybe nothing went wrong but some how I'm sure something went wrong. Thank you. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Supplied-p parameter in clojure similar to lisp lambda lists
What is the commonly accepted technique for declaring/using 'supplied-p' type lambda list functionality in clojure? http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html I have some clojure functions with a large number of keywords and various defaults, I want to know if a keyword was specified by the caller (rather than defaulted) in some cases. Certainly I could implement my own destructuring macros that did this, but I'd like to avoid reinventing a wheel here if I can, and also to know the idiomatic clojure way to do it. Thanks for any tips. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to tackle this concurrency problem?
Maybe you want an Agent. On Jun 20, 2014, at 12:10 PM, Hussein B. hubaghd...@gmail.com wrote: Hi, I have a ref that saves the ID of last processed event. Of course, I'm using Clojure STM facility. The problem now is I can't control the value of the ref. Due massive concurrency, it is updated and my logic is broken. How to guard, and really guard the update of that ref? Should I do (locking) ? Thanks for help and time. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Invalid timestamp
Hello, i am dealing with timestamp in my cascalog query . My code snippet looks like (def datefrom 2010:05:03 13:20:47) (def custom-formatter (f/formatter :MM:dd HH:mm:ss)) (def start-value (ct/to-long (f/parse custom-formatter datefrom))) (def dateto 2012:09:01 08:17:00) (def end-value (ct/to-long (f/parse custom-formatter dateto))) (defn convert-to-long [a] (ct/to-long (f/parse custom-formatter a))) (?- (stdout) [?timestamp ?category_description ] (info-tap : ?timestamp ?category_description ) (convert-to-long ?timestamp : ?converted-timestamp) (= ?converted-timestamp start-value)(= ?converted-timestamp end-value) ) my data looks like Timestamp;assembly;category_description;eventtext;downtime;tag;process;state 2012:09:01 10:20:00;Turbine1;Event from the CU which indicates an A event;Event642;;5;f;5373 2012:09:01 10:20:30;Turbine1;Event from the CU which indicates an A event;Event642;;5;f;5373 2012:09:01 10:21:00;Turbine1;Event from the CU which indicates an A event;Event642;;5;f;5373 2012:09:01 10:21:30;Turbine1;Event from the CU which indicates an A event;Event642;;5;f;5373 I have created a custom formatter same as how my timestamp field in data looks like .But inspite when i run it shows me Caused by: java.lang.IllegalArgumentException: Invalid format: Timestamp whats wrong in my code ? i don't understand. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Is it the right Clojure group for a newbie
Awesome book :) I started my Clojure journey by going to Nicaragua for two weeks with the Little Schemer and a pad of paper. I'd spend a couple of hours by the beach each morning, writing lisp out by hand. You'll be in a pretty good head space for it by the time you get back. douglas smith mailto:0padou...@gmail.com June 6, 2014 at 7:32 AM here is pdf of Little Schemer http://scottn.us/downloads/The_Little_Schemer.pdf On Friday, June 6, 2014 9:17:58 AM UTC-4, douglas smith wrote: -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com mailto:clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. douglas smith mailto:0padou...@gmail.com June 6, 2014 at 7:17 AM Sounds like we are in a similar position. Maybe we could start a study group of sorts. -not sure how? We could post back to this thread for now and see what happens. Someone have a better suggestion? Doug On Monday, June 2, 2014 5:36:51 PM UTC-4, shar...@gmail.com wrote: -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com mailto:clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. sharma...@gmail.com mailto:sharma...@gmail.com June 2, 2014 at 3:36 PM All, If this is the right Clojure group for a newbie, I would like to ask for the best online resources to begin with. I am new to programming, having recently switched from a non technical field. I have started looking at http://www.braveclojure.com/, but any pointers would be useful, especially cookbook styled ones. Abha -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com mailto:clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Sam Ritchie (@sritchie) Paddleguru Co-Founder 703.863.8561 www.paddleguru.com http://www.paddleguru.com/ Twitter http://twitter.com/paddleguru// Facebook http://facebook.com/paddleguru -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Invalid timestamp
It it perhaps reading the first line of your file and running it trough the parser? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Invalid timestamp
yup, responded as such on the Cascalog list. (That's a better place for these questions; no need to cross post to the main group.) Mike Fikes mailto:mikefi...@me.com June 20, 2014 at 5:57 PM It it perhaps reading the first line of your file and running it trough the parser? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com mailto:clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. sindhu hosamane mailto:sindh...@gmail.com June 20, 2014 at 3:40 PM Hello, i am dealing with timestamp in my cascalog query . My code snippet looks like (def datefrom 2010:05:03 13:20:47) (defcustom-formatter(f/formatter:MM:dd HH:mm:ss)) (def start-value (ct/to-long (f/parse custom-formatter datefrom))) (def dateto 2012:09:01 08:17:00) (def end-value (ct/to-long (f/parse custom-formatter dateto))) (defn convert-to-long [a] (ct/to-long (f/parse custom-formatter a))) (?- (stdout) [?timestamp ?category_description ] (info-tap : ?timestamp ?category_description ) (convert-to-long ?timestamp : ?converted-timestamp) (= ?converted-timestamp start-value)(= ?converted-timestamp end-value) ) my data looks like Timestamp;assembly;category_description;eventtext;downtime;tag;process;state 2012:09:01 10:20:00;Turbine1;Event from the CU which indicates an A event;Event642;;5;f;5373 2012:09:01 10:20:30;Turbine1;Event from the CU which indicates an A event;Event642;;5;f;5373 2012:09:01 10:21:00;Turbine1;Event from the CU which indicates an A event;Event642;;5;f;5373 2012:09:01 10:21:30;Turbine1;Event from the CU which indicates an A event;Event642;;5;f;5373 I have created a custom formatter same as how my timestamp field in data looks like .But inspite when i run it shows me Caused by: java.lang.IllegalArgumentException: Invalid format: Timestamp whats wrong in my code ? i don't understand. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com mailto:clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Sam Ritchie (@sritchie) Paddleguru Co-Founder 703.863.8561 www.paddleguru.com http://www.paddleguru.com/ Twitter http://twitter.com/paddleguru// Facebook http://facebook.com/paddleguru -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Is it the right Clojure group for a newbie
As far as I know, this book is not free to distribute. On Friday, June 6, 2014 9:32:27 AM UTC-4, douglas smith wrote: here is pdf of Little Schemer http://scottn.us/downloads/The_Little_Schemer.pdf On Friday, June 6, 2014 9:17:58 AM UTC-4, douglas smith wrote: Sounds like we are in a similar position. Maybe we could start a study group of sorts. -not sure how? We could post back to this thread for now and see what happens. Someone have a better suggestion? Doug On Monday, June 2, 2014 5:36:51 PM UTC-4, shar...@gmail.com wrote: All, If this is the right Clojure group for a newbie, I would like to ask for the best online resources to begin with. I am new to programming, having recently switched from a non technical field. I have started looking at http://www.braveclojure.com/, but any pointers would be useful, especially cookbook styled ones. Abha -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.