Re: [ANN] Counterclockwise - Clojure plugin for Eclipse
Nice work, looking forward to using this. I'm wondering though, what is the best or official way to import a lein project? I've never been able to figure it out, so I always do lein pom and import as maven project and then convert to leiningen project. Is there a better way? On Saturday, October 12, 2013 2:11:53 AM UTC+2, Steve Buikhuizen wrote: Laurent, you rock! Auto-formatting is already saving my fingers a lot of travelling. Thanks for the great work. -- -- 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/groups/opt_out.
Reading namespaced keywords
I am reading a bunch of clojure files using the build-in reader (or tools.reader, it has the same problem) and I am running into a problem regarding namespaced keywords (is that the right term?) such as ::l/test. = (read-string ::l/test) RuntimeException Invalid token: ::l/test clojure.lang.Util.runtimeException (Util.java:219) It seems that the reader requires the namespace alias 'l' to exist. This is a shame because in most (all?) other respects the reader is able to just read in the symbols even if their namespace is not loaded. So in order for me to read a file with a namespaced keyword I need to eval at least the ns form of the file, which then requires me to eval the ns forms of its dependencies (and so on). My code is basically building on the excellent codeq analyzer (https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/analyzers/clj.clj), so I am guessing this would have the same problem when running into a similar namespaced keyword. So my question is how do I best get around this? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Reading namespaced keywords
The double colon keyword creates a namespaced keyword and is perfectly valid syntax. It's just not used that often :) By default a keyword like ::test resolves to the current namespace like ::current-ns/test, but you can also provide another ns which causes the problem when reading. Have at look at https://github.com/clojure/core.logic/blob/0d1d545f0a81c585c7449aecb5d661120f3da568/src/main/clojure/clojure/core/logic/fd.clj for instance. On Wednesday, September 18, 2013 1:05:01 AM UTC+2, daveray wrote: Hey, You have too many colons: user= (read-string :l/test) :l/test Dave On Tue, Sep 17, 2013 at 4:03 PM, Casper Clausen cas...@gmail.comjavascript: wrote: I am reading a bunch of clojure files using the build-in reader (or tools.reader, it has the same problem) and I am running into a problem regarding namespaced keywords (is that the right term?) such as ::l/test. = (read-string ::l/test) RuntimeException Invalid token: ::l/test clojure.lang.Util.runtimeException (Util.java:219) It seems that the reader requires the namespace alias 'l' to exist. This is a shame because in most (all?) other respects the reader is able to just read in the symbols even if their namespace is not loaded. So in order for me to read a file with a namespaced keyword I need to eval at least the ns form of the file, which then requires me to eval the ns forms of its dependencies (and so on). My code is basically building on the excellent codeq analyzer ( https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/analyzers/clj.clj), so I am guessing this would have the same problem when running into a similar namespaced keyword. So my question is how do I best get around this? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: ANN swag a DSL for documenting Compojure routes using Swagger
Nice work. Looking forward to giving it a spin. On Thursday, August 15, 2013 12:13:11 PM UTC+2, ronen wrote: Swagger https://developers.helloreverb.com/swagger/ is a cool project for documenting Restful API's, Swag is a DSL that wraps Compojure routes enabling them to be listed and described automagically without the need of maintaining json https://github.com/narkisr/swag Feedback is welcome Ronen -- -- 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/groups/opt_out.
Re: Idiomatic way to write dependency resolving algorithms?
Here is a similar algorithm I did for work a while back: (defn- find-next-node [deps used-nodes] (some (fn [[k v]] (if (empty? (remove used-nodes v)) k)) deps)) (defn topsort Takes a map of dependencies between items and performs a topological sort. E.g. (topsort {1 [2 3] 3 [] 2 [3]}) = [3 2 1] [deps] (loop [deps deps res []] (if (empty? deps) res (if-let [item (find-next-node deps (set res))] (recur (dissoc deps item) (conj res item)) (throw (Exception. (str A circular dependency was found: deps))) I am not sure if it is optimal, but it does it without the atom which is a bit nicer i think. I'm also open to input for a better way of course. On Friday, May 31, 2013 6:33:59 PM UTC+2, Alice wrote: (def graph {a {:dependencies [b d]} b {:dependencies [c e]} c {:dependencies [d e]} d {:dependencies []} e {:dependencies []}}) (defn resolve-dep [graph name] (let [resolved (atom []) resolved-set (atom #{}) f (fn f [name] (doseq [x (:dependencies (graph name))] (f x)) (when-not (@resolved-set name) (swap! resolved conj name) (swap! resolved-set conj name)))] (f name) @resolved)) (resolve-dep graph a) ;= [d e c b a] This code works, but not sure if it's idiomatic clojure code. The use of atom feels like procedural than functional to me since there's no concurrency involved at all. Any suggestions? -- -- 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/groups/opt_out.
Re: Idiomatic way to write dependency resolving algorithms?
Also yours explodes if given a circular dependency. There is no way around throwing an exception, but it is always nice not to have stack overflows in your code: (def graph {a {:dependencies [b d]} b {:dependencies [c e]} c {:dependencies [d e]} d {:dependencies [c]} e {:dependencies []}}) (resolve-dep graph c) = java.lang.StackOverflowError On Sunday, June 9, 2013 10:30:51 AM UTC+2, Casper Clausen wrote: Here is a similar algorithm I did for work a while back: (defn- find-next-node [deps used-nodes] (some (fn [[k v]] (if (empty? (remove used-nodes v)) k)) deps)) (defn topsort Takes a map of dependencies between items and performs a topological sort. E.g. (topsort {1 [2 3] 3 [] 2 [3]}) = [3 2 1] [deps] (loop [deps deps res []] (if (empty? deps) res (if-let [item (find-next-node deps (set res))] (recur (dissoc deps item) (conj res item)) (throw (Exception. (str A circular dependency was found: deps))) I am not sure if it is optimal, but it does it without the atom which is a bit nicer i think. I'm also open to input for a better way of course. On Friday, May 31, 2013 6:33:59 PM UTC+2, Alice wrote: (def graph {a {:dependencies [b d]} b {:dependencies [c e]} c {:dependencies [d e]} d {:dependencies []} e {:dependencies []}}) (defn resolve-dep [graph name] (let [resolved (atom []) resolved-set (atom #{}) f (fn f [name] (doseq [x (:dependencies (graph name))] (f x)) (when-not (@resolved-set name) (swap! resolved conj name) (swap! resolved-set conj name)))] (f name) @resolved)) (resolve-dep graph a) ;= [d e c b a] This code works, but not sure if it's idiomatic clojure code. The use of atom feels like procedural than functional to me since there's no concurrency involved at all. Any suggestions? -- -- 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/groups/opt_out.
Re: JSON escaping
Don't know about cheshire, but the newest version of clojure.data.json has a :escape-slash option which does the trick. On Saturday, February 9, 2013 12:18:50 AM UTC+1, Jonathon McKitrick wrote: I'm generating JSON for salesforce/apex consumption, and apparently Apex does not like correctly escaped JSON with backslashes. But Cheshire (the JSON library I'm using) does not seem to have an option to generate JSON without escaped content. Is there a simple way to solve this problem? I'm sure it's a simple one, but I'm new to clojure, and I'm short on time to solve the issue. 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/groups/opt_out.
Re: Why is this code so slow?
Given that I don't know much about how scala does optimizations, I find the question of why the scala version is faster than the Java version even more interesting. It seems to me that in Scala, the list (don't know the actual data type which is created) of 1 to 20 is created each time isDivisibleByAll is called which (probably?) creates some overhead. The Java version doesn't create the list for each check, but it uses an ArrayList where it could use an array and Integer where it could use int - shenedu makes that optimization in the buttom, but it only improves about half a second according to him. So what's going on the Scala version? On Sunday, February 3, 2013 3:28:09 AM UTC+1, Alexandros Bantis wrote: Hello all. I'm working through the Project Euler problems in Java, Scala, Clojure (trying to learn all three?!?). I notice that for one particular problem, I use--more or less--a similar algorithm for all three, but the clojure code runs about 20-30 times slower than the java/scala versions. Does anyone have any idea why this might be? It strikes me that it might have something to do with every? but I don't know because I'm a newbie with Clojure. http://stackoverflow.com/questions/14668272/what-can-i-do-to-speed-up-this-code thanks, alex -- -- 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/groups/opt_out.
Re: [ANN] moderns-cljs tutorial 6
I just want to chime in and say good work. This exactly what I have been looking for as a gentle introduction to clojurescript. If I can make one suggestion, it would be nice to have each chapter accompanied by a project for that chapter. It would mean a lot less copy and paste to follow along with the examples. /Casper On Tuesday, November 13, 2012 5:41:49 PM UTC+1, Mimmo Cosenza wrote: Hi all, I'm always a little bit afraid in announcing my small results as a clojure/cljurescript newbie to such a smart community of programmers. I just published on github my learning efforts in the 6th tutorial on clojurescript https://github.com/magomimmo/modern-cljs Hope it can help other newbies like me. Mimmo -- 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: future with user specified ExecutorService
+1 That would be nice. This may not be the right place for the suggestion though. On Thursday, October 25, 2012 2:43:58 PM UTC+2, Max Penet wrote: wrong commit: https://github.com/mpenet/clojure/commit/9c6e47524dc21c6bdfaa9d0cc2a69377cc69cbf3 On Thursday, October 25, 2012 2:35:01 PM UTC+2, Max Penet wrote: Another enhancement proposal, would it be possible to have a future-call arity with an additional argument as the ExecutorService used. It seems to be a trivial but useful modification, but I wanted to ask here before creating a ticket for this. Something like this maybe: https://github.com/mpenet/clojure/commit/e5295ac1aa49036c98a3a4e18cba974cd72483d5 Max -- 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: PersistentHashMaps coming to ClojureScript
Excellent! Any idea how this implementation would compare performance wise to the java implementation if imported to Clojure? On Apr 20, 8:36 pm, Michał Marczyk michal.marc...@gmail.com wrote: It's pure ClojureScript. Hopefully a step towards CinC, yes. :-) Sincerely, Michał On 20 April 2012 20:32, Brent Millare brent.mill...@gmail.com wrote: Quick question, so does this mean we have clojure's persistent data structures implemented in clojurescript or js? This would mean we are one more step closer to C-in-C right? On Friday, April 20, 2012 1:38:17 PM UTC-4, Michał Marczyk wrote: Since the latest PHM patch has now been merged to master (thanks, David!), I wanted to take this opportunity to note that porting all that Java code (including the transient support for PHM -- a working version of which is available for testing in its own ticket [1] -- and now the PersistentTreeMap [2]) has been completely smooth sailing. Some additions have been made to the implementation to improve performance while maintaining clarity of the code (here some excellent suggestions from David were very helpful), but the initial implementation already worked without them and client code could absolutely replicate them (by providing the requisite compiler macros in its own namespace). It's not that I expected insurmountable difficulties, but experiencing just how complete ClojureScript already is in the context of this sort of non-trivial data structure implementation task has been amazing. For those interested in how PHM's performance compares to that of the previously used ObjMap and HashMap copy-on-write implementations, there are some jsPerf tests linked to from the ticket [3]. There's also a TransientHM vs. PHM comparison linked to from [2]. Sincerely, Michał [1]http://dev.clojure.org/jira/browse/CLJS-181 [2]http://dev.clojure.org/jira/browse/CLJS-187 [3]http://dev.clojure.org/jira/browse/CLJS-178 -- 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: Typed Clojure 0.1-alpha2
Looks interesting. Personally I always thought clojure's handling of function arity is a bit strange. I don't understand why calling a function like this (defn testfn [one two] ...) (test-fn 1) is not at least a compiler warning, possibly with a switch for the compiler for strict checking. I understand that it is not always possible to perform this check, but why not do it when possible? It would make clojure alot safer to use without a test suite covering every code path. On Apr 20, 8:50 pm, Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com wrote: Hi, I know there are a few people interested in trying Typed Clojure, so I've cut an early alpha release to give a taste. These are *very* early days, but looking through the readme will give you some hints as to what works in this release. Don't expect too much. https://github.com/frenchy64/typed-clojure Please give it a whirl, feedback welcome! Thanks, Ambrose -- 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: Type hints and records
Thanks for the clarification. Just to clear up any confusion, the .toString example was just the simplest example I could think of that illustrated was I was seeing with regards to reflection and type hints :) On Oct 20, 4:22 am, Michael Fogus mefo...@gmail.com wrote: Another potential option is to implement a record toString method: (defrecord Rec [^Integer i] Object (toString [_] (str i))) (str (Rec. 42)) ;= 42 -- 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