Re: Beginners question - emacs compiling tests
On Tuesday, March 19, 2013 4:22:59 PM UTC-7, John SJ Anderson wrote: I had this same issue when working through the tutorial. The text makes it sound like you should replace the entire contents of the test file, but that's not the case -- you just need to replace the (deftest ...) form. (I ended up having to generate the project tree under a slightly different name to get a good copy of the file back.) I have a similar issue, except that I did leave my file intact: (ns command-line-args.core-test (:require [clojure.test :refer :all] [command-line-args.core :refer :all])) (deftest pairs-of-values (let [args [--server localhost --port 8080 --environment production]] (is (= {:server localhost :port 8080 :environment production} (parse-args args) (defn parse-args [args] {}) Results in: clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable to resolve symbol: parse-args in this context, compiling:(/Users/getchell/Projects/clojure/command-line-args/test/command_line_args/core_test.clj:12:12) at clojure.lang.Compiler.analyze (Compiler.java:6380) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3573) clojure.lang.Compiler.analyzeSeq (Compiler.java:6562) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3624) clojure.lang.Compiler.analyzeSeq (Compiler.java:6562) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.access$100 (Compiler.java:37) clojure.lang.Compiler$LetExpr$Parser.parse (Compiler.java:5973) clojure.lang.Compiler.analyzeSeq (Compiler.java:6560) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyzeSeq (Compiler.java:6548) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5708) clojure.lang.Compiler$TryExpr$Parser.parse (Compiler.java:2156) clojure.lang.Compiler.analyzeSeq (Compiler.java:6560) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyzeSeq (Compiler.java:6548) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyzeSeq (Compiler.java:6548) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyzeSeq (Compiler.java:6548) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5708) clojure.lang.Compiler$LetExpr$Parser.parse (Compiler.java:6009) clojure.lang.Compiler.analyzeSeq (Compiler.java:6560) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyzeSeq (Compiler.java:6548) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5708) clojure.lang.Compiler$FnMethod.parse (Compiler.java:5139) clojure.lang.Compiler$FnExpr.parse (Compiler.java:3751) clojure.lang.Compiler.analyzeSeq (Compiler.java:6558) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyzeSeq (Compiler.java:6548) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$MapExpr.parse (Compiler.java:2879) clojure.lang.Compiler.analyze (Compiler.java:6369) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$DefExpr$Parser.parse (Compiler.java:528) clojure.lang.Compiler.analyzeSeq (Compiler.java:6560) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler.eval (Compiler.java:6623) clojure.lang.Compiler.load (Compiler.java:7064) command_line_args.core_test$eval1168.invoke (NO_SOURCE_FILE:1) clojure.lang.Compiler.eval (Compiler.java:6619) clojure.lang.Compiler.eval (Compiler.java:6582) clojure.core$eval.invoke (core.clj:2852) clojure.main$repl$read_eval_print__6588$fn__6591.invoke (main.clj:259) clojure.main$repl$read_eval_print__6588.invoke (main.clj:259) clojure.main$repl$fn__6597.invoke (main.clj:277) clojure.main$repl.doInvoke (main.clj:277) clojure.lang.RestFn.invoke (RestFn.java:1096) clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__588.invoke (interruptible_eval.clj:56) clojure.lang.AFn.applyToHelper (AFn.java:159) clojure.lang.AFn.applyTo (AFn.java:151) clojure.core$apply.invoke (core.clj:617) clojure.core$with_bindings_STAR_.doInvoke (core.clj:1788) clojure.lang.RestFn.invoke (RestFn.java:425)
Re: ref-history-count always return 0?
You may want to use the code from https://gist.github.com/Chouser/456326 to study how the history in refs works. See the accompanying discussion at http://clojure-log.n01se.net/date/2010-06-28.html. I've been using variants of that stress test to explain the ref history behavior since then and people seem to be happy with it. Kudos to chouser obviously! -- -- 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] lein-pedantic is now deprecated
Hi Nelson, thanks for making lein-pedantic. It has been useful to us. Happy to see it built in to Leiningen! -S On Wednesday, May 29, 2013 9:25:22 PM UTC-4, Nelson Morris wrote: Good news everybody! As of leiningen 2.2.0 using `lein deps :tree` will perform version checks and version range detection. Therefore, I have deprecated lein-pedantic. I appreciate all of the users of the plugin that found it useful. I believe there are two pieces of functionality that do not currently have a replacement: 1) ability to fail the task when a bad dependency resolution happens 2) exact instructions of what to place in project.clj to make things work If you are interested in these, please let me know here, and I'll see about adding them in a future leiningen release. - Nelson Morris -- -- 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: Beginners question - emacs compiling tests
The 'parse-args' function needs to be inside of the 'core.clj' file, not the 'core_test.clj' file - is that the case? (The reason it is failing is the first usage of 'parse-args' is before it has been defined). On Fri, May 31, 2013 at 1:31 AM, Adam Getchell adam.getch...@gmail.comwrote: On Tuesday, March 19, 2013 4:22:59 PM UTC-7, John SJ Anderson wrote: I had this same issue when working through the tutorial. The text makes it sound like you should replace the entire contents of the test file, but that's not the case -- you just need to replace the (deftest ...) form. (I ended up having to generate the project tree under a slightly different name to get a good copy of the file back.) I have a similar issue, except that I did leave my file intact: (ns command-line-args.core-test (:require [clojure.test :refer :all] [command-line-args.core :refer :all])) (deftest pairs-of-values (let [args [--server localhost --port 8080 --environment production]] (is (= {:server localhost :port 8080 :environment production} (parse-args args) (defn parse-args [args] {}) Results in: clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable to resolve symbol: parse-args in this context, compiling:(/Users/getchell/Projects/clojure/command-line-args/test/command_line_args/core_test.clj:12:12) at clojure.lang.Compiler.analyze (Compiler.java:6380) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3573) clojure.lang.Compiler.analyzeSeq (Compiler.java:6562) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3624) clojure.lang.Compiler.analyzeSeq (Compiler.java:6562) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.access$100 (Compiler.java:37) clojure.lang.Compiler$LetExpr$Parser.parse (Compiler.java:5973) clojure.lang.Compiler.analyzeSeq (Compiler.java:6560) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyzeSeq (Compiler.java:6548) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5708) clojure.lang.Compiler$TryExpr$Parser.parse (Compiler.java:2156) clojure.lang.Compiler.analyzeSeq (Compiler.java:6560) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyzeSeq (Compiler.java:6548) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyzeSeq (Compiler.java:6548) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyzeSeq (Compiler.java:6548) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5708) clojure.lang.Compiler$LetExpr$Parser.parse (Compiler.java:6009) clojure.lang.Compiler.analyzeSeq (Compiler.java:6560) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyzeSeq (Compiler.java:6548) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5708) clojure.lang.Compiler$FnMethod.parse (Compiler.java:5139) clojure.lang.Compiler$FnExpr.parse (Compiler.java:3751) clojure.lang.Compiler.analyzeSeq (Compiler.java:6558) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyzeSeq (Compiler.java:6548) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$MapExpr.parse (Compiler.java:2879) clojure.lang.Compiler.analyze (Compiler.java:6369) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler$DefExpr$Parser.parse (Compiler.java:528) clojure.lang.Compiler.analyzeSeq (Compiler.java:6560) clojure.lang.Compiler.analyze (Compiler.java:6361) clojure.lang.Compiler.analyze (Compiler.java:6322) clojure.lang.Compiler.eval (Compiler.java:6623) clojure.lang.Compiler.load (Compiler.java:7064) command_line_args.core_test$eval1168.invoke (NO_SOURCE_FILE:1) clojure.lang.Compiler.eval (Compiler.java:6619) clojure.lang.Compiler.eval (Compiler.java:6582) clojure.core$eval.invoke (core.clj:2852) clojure.main$repl$read_eval_print__6588$fn__6591.invoke (main.clj:259) clojure.main$repl$read_eval_print__6588.invoke (main.clj:259) clojure.main$repl$fn__6597.invoke (main.clj:277) clojure.main$repl.doInvoke (main.clj:277) clojure.lang.RestFn.invoke (RestFn.java:1096)
Re: I don't feel the absence of a debugger, because I've learnt enough that I don't ever need a debugger.
I'd like to point out a similar library I wrote for Clojure called spyscope: https://github.com/dgrnbrg/spyscope With spyscope, you can write a handful of characters and get the stack frame, form, and its value pretty-printed and logged to a queue for future querying. On Thursday, May 30, 2013 8:28:19 PM UTC-4, David Jacobs wrote: That's true -- that's why I wrote up the Letters debugging mini-library for Ruby (lettersrb.com). However, there's friction there, too, and a surprising number of people don't think to do this. On Thursday, May 30, 2013 at 5:25 PM, Timothy Baldridge wrote: Not really true, most of my programs contain this function: (defn debug [x] (pprint x) x) Now I can do this: (comp foo debug bar) Also, with some reader literal magic, I could write something to let me do this: (myfunc foo #dbg bar) On Thu, May 30, 2013 at 6:12 PM, David Jacobs da...@wit.iojavascript:(mailto: da...@wit.io javascript:) wrote: Two more things: 1) printing is often not a viable option for lazily eval-ed sequences or async processes -- the output gets jumbled! And believe me, when a new Clojure dev sees that for the first time, he/she wants to quit. 2) printing is terrible for elegant clojure code -- thing (comp f g h (partial map z)) -- in order to figure out anything about dynamic data flowing through, you have to break apart that composition or add a let binding in one of those functions before returning a value. Both of those involve a lot of friction. On Thursday, May 30, 2013 5:00:13 PM UTC-7, raould wrote: for a long time haskell did not have a debugger. that sucked, imho. -- -- 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:(mailto: clo...@googlegroups.com javascript:) 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: (mailto: clojure%2b...@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: (mailto: clojure%2b...@googlegroups.com javascript:). For more options, visit https://groups.google.com/groups/opt_out. -- “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 clo...@googlegroups.comjavascript:(mailto: clo...@googlegroups.com javascript:) 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: (mailto: 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: (mailto: 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.
Idiomatic way to write dependency resolving algorithms?
(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?
You can express the algorithm using reduce with the set as an accumulator. Also, consider: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4969 and related hierarchy functions. On Fri, May 31, 2013 at 12:33 PM, Alice dofflt...@gmail.com 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. -- -- 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.
[ANN] Introducing Simplecs 0.1.0 - A Component-Entity-System game engine
Simplecs is a Component-Entity-System game engine used to write games in a modular fashion. It was inspired by a blog post by Chris Grangerhttp://www.chris-granger.com/2012/12/11/anatomy-of-a-knockout/ (also see Gambit https://github.com/ibdknox/gambit). You can find it here https://github.com/s-k/simplecs. If you have any comments, feel free to tell me. Stephen -- -- 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?
If you're curious to see alternatives, I wrote a basic dependency graph library based on Clojure's hierarchy implementation. It's part of tools.namespace: https://github.com/clojure/tools.namespace/blob/tools.namespace-0.2.3/src/main/clojure/clojure/tools/namespace/dependency.clj Or also available standalone: https://github.com/stuartsierra/dependency -S On Friday, May 31, 2013 12:33:59 PM UTC-4, 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: [ANN] lein-pedantic is now deprecated
I stopped using it for a week and discovered I won't stay sane for long without it. Big (inc) to you. On Friday, May 31, 2013 at 7:55 AM, Stuart Sierra wrote: Hi Nelson, thanks for making lein-pedantic. It has been useful to us. Happy to see it built in to Leiningen! -S On Wednesday, May 29, 2013 9:25:22 PM UTC-4, Nelson Morris wrote: Good news everybody! As of leiningen 2.2.0 using `lein deps :tree` will perform version checks and version range detection. Therefore, I have deprecated lein-pedantic. I appreciate all of the users of the plugin that found it useful. I believe there are two pieces of functionality that do not currently have a replacement: 1) ability to fail the task when a bad dependency resolution happens 2) exact instructions of what to place in project.clj to make things work If you are interested in these, please let me know here, and I'll see about adding them in a future leiningen release. - Nelson Morris -- -- 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 (mailto: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 (mailto: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/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: I don't feel the absence of a debugger, because I've learnt enough that I don't ever need a debugger.
Very cool, will have to try it out! That said, I think we should start talking about how to make the traditional debugging cycle accessible in Clojure. On Friday, May 31, 2013 at 8:27 AM, dgrnbrg wrote: I'd like to point out a similar library I wrote for Clojure called spyscope: https://github.com/dgrnbrg/spyscope With spyscope, you can write a handful of characters and get the stack frame, form, and its value pretty-printed and logged to a queue for future querying. On Thursday, May 30, 2013 8:28:19 PM UTC-4, David Jacobs wrote: That's true -- that's why I wrote up the Letters debugging mini-library for Ruby (lettersrb.com (http://lettersrb.com)). However, there's friction there, too, and a surprising number of people don't think to do this. On Thursday, May 30, 2013 at 5:25 PM, Timothy Baldridge wrote: Not really true, most of my programs contain this function: (defn debug [x] (pprint x) x) Now I can do this: (comp foo debug bar) Also, with some reader literal magic, I could write something to let me do this: (myfunc foo #dbg bar) On Thu, May 30, 2013 at 6:12 PM, David Jacobs da...@wit.io (mailto:da...@wit.io) wrote: Two more things: 1) printing is often not a viable option for lazily eval-ed sequences or async processes -- the output gets jumbled! And believe me, when a new Clojure dev sees that for the first time, he/she wants to quit. 2) printing is terrible for elegant clojure code -- thing (comp f g h (partial map z)) -- in order to figure out anything about dynamic data flowing through, you have to break apart that composition or add a let binding in one of those functions before returning a value. Both of those involve a lot of friction. On Thursday, May 30, 2013 5:00:13 PM UTC-7, raould wrote: for a long time haskell did not have a debugger. that sucked, imho. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com (mailto:clo...@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+u...@googlegroups.com (mailto:clojure%2b...@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+u...@googlegroups.com (mailto:clojure%2b...@googlegroups.com). For more options, visit https://groups.google.com/groups/opt_out. -- “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 clo...@googlegroups.com (mailto:clo...@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+u...@googlegroups.com (mailto:clojure+u...@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+u...@googlegroups.com (mailto:clojure+u...@googlegroups.com). 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. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to
keys maps ... gak
Sometimes its just so frustrating when you know you are close but just cannot get that last little bit ... so I am appealing again for more newbie support I have a map for some names: user= (def entity-names {:project Project :model Model}) Which I then reference in a set of maps: user= def query-parts #{{:entity (entity-names :project ) :main-query select * from project where ... } {:entity (entity-names :model ) :main-query select * from model where ... }}) This query-parts is actually a large set. It will form the basis of execution and sometimes I want to execute a smaller set of the queries. So I want to be able to filter it based on a subset of the entity names, for example just :model. user= (select #(= (:model entity-names) (:entity %)) query-parts) #{{:entity Model, :main-query Model Query}} So that works great. But I would like a list of entities (:model :project :foo :bar) that represents a subset of the complete set of query parts. So I just (sic!) need some advice on how to run this select over a list of entity names rather than just the one shown above. I'm ashamed to say that I have spent an hour on this already so this is my white flag. I hope you can help. Thanks Ray -- -- 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.
[ANN] core.rrb-vector -- RRB-Tree-based confluently persistent vectors
Hi, The initial release of core.rrb-vector, a Clojure Contrib library enabling logarithmic-time concatenation and slicing of Clojure vectors, should be available from Maven Central within 24 hours. The functionality provided is enabled by RRB-Trees, a vector-like data structure capable of sharing structure with regular vectors introduced in Bagwell Rompf, RRB-Trees: Efficient Immutable Vectors, EPFL-REPORT-169879, September, 2011. core.rrb-vector started its life as flexvec and was recently accepted into Clojure Contrib. The official project repository is available here: https://github.com/clojure/core.rrb-vector To take it for a spin in a Leiningen project, add [org.clojure/core.rrb-vector 0.0.9] to your :dependencies; then at the REPL say (require '[clojure.core.rrb-vector :as fv]) (doc fv/catvec) (doc fv/subvec) This should probably be considered alpha-stage software, if only because there is one piece of the Clojure vector API not yet supported (transients). What is implemented (everything else in the standard vector API plus the two new operations) should work, however; if there are any issues, reports thereof would be highly appreciated. Note that due to certain complications around sharing structure with Clojure's PersistentVector, core.rrb-vector only supports Clojure = 1.5.0. The functions provided by core.rrb-vector can take all regular Clojure vector types as arguments (this includes vectors of primitives produced by clojure.core/vector-of) and return RRB vectors which support the full Clojure vector API with the exception of transient operations (support for which will be introduced in a future version). Of course RRB vectors themselves can then be further concatenated and sliced. NB. the element types of vectors to be concatenated together must match. (In particular, RRB vectors produced as a result of concatenating or slicing vectors of primitives will themselves store unboxed primitives.) With the current implementation of catvec, concatenating two regular PersistentVector instances of 2048 elements each is faster with catvec than with into at my REPL; at 1024 elements into is faster. A future version will replace the current implementation of catvec with a lower-level one, so the threshold will shift; at some point, the straightforward optimization of delegating to into below some experimentally determined size of the right argument will be introduced. (In fact, vectors of up to 32 elements are already handled in this way because of certain implementation details.) See the README or (doc clojure.core.rrb-vector) for more information. Cheers, Michał -- -- 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.
[ANN] core.rrb-vector -- RRB-Tree-based confluently persistent vectors
Apologies for my lack of knowledge. My understanding was that a finger tree implementation has been in development for some time and was to provide the same benefits. Can you explain the differences between RRB trees and finger trees? Any hope of getting this project into core? -- -- 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.
Simple socket programming problem
Hello, I'm trying to create a very simple interaction between a client and server program using the server-socket library which used to be part of clojure-contrib and is now maintained by technomancy https://github.com/technomancy/server-socket/blob/master/src/server/socket.clj I created a simple echo server, which works fine when accessed by telnet but can't seem to accept messages from the python client. This is the code for the client and the server: client.py: import socket s = socket.socket() host = socket.gethostname() port = 9001 s.connect((host,port)) while 1: s.send(Hello) print s.recv(1024) s.close() And this is the code for the server--I tried to capture all of the input into a vector, but the vector never seems to change: (ns bot-backend.core) (use 'server.socket) (import '(java.io BufferedReader InputStreamReader PrintWriter)) (def server (create-server 9001 (fn [in out] (binding [*in* (BufferedReader. (InputStreamReader. in)) *out* (PrintWriter. out)] (loop [input []] (println input) (recur (conj input (read-line The only output the client displays is a single empty vector after which it waits to receive more data. Since this works correctly when I access the port over telnet I can't figure out what the problem is. As a novice to both clojure and socket programming my best guess is that it has something to do with multiple threading--I know that both python and clojure create a new thread for each distinct socket. It's probably an incorrect guess. That's why I've decided to consult the community :D. Any help is appreciated in advance! -- -- 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] lein-pedantic is now deprecated
Another +1 for those features. On Wednesday, May 29, 2013 6:25:22 PM UTC-7, Nelson Morris wrote: Good news everybody! As of leiningen 2.2.0 using `lein deps :tree` will perform version checks and version range detection. Therefore, I have deprecated lein-pedantic. I appreciate all of the users of the plugin that found it useful. I believe there are two pieces of functionality that do not currently have a replacement: 1) ability to fail the task when a bad dependency resolution happens 2) exact instructions of what to place in project.clj to make things work If you are interested in these, please let me know here, and I'll see about adding them in a future leiningen release. - Nelson Morris -- -- 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: Simple socket programming problem
What happens if you send a newline after that Hello? ie. Hello\n since you're using read-line On Sat, Jun 1, 2013 at 3:44 AM, Andrew Spano werdnaon...@gmail.com wrote: Hello, I'm trying to create a very simple interaction between a client and server program using the server-socket library which used to be part of clojure-contrib and is now maintained by technomancy https://github.com/technomancy/server-socket/blob/master/src/server/socket.clj I created a simple echo server, which works fine when accessed by telnet but can't seem to accept messages from the python client. This is the code for the client and the server: client.py: import socket s = socket.socket() host = socket.gethostname() port = 9001 s.connect((host,port)) while 1: s.send(Hello) print s.recv(1024) s.close() And this is the code for the server--I tried to capture all of the input into a vector, but the vector never seems to change: (ns bot-backend.core) (use 'server.socket) (import '(java.io BufferedReader InputStreamReader PrintWriter)) (def server (create-server 9001 (fn [in out] (binding [*in* (BufferedReader. (InputStreamReader. in)) *out* (PrintWriter. out)] (loop [input []] (println input) (recur (conj input (read-line The only output the client displays is a single empty vector after which it waits to receive more data. Since this works correctly when I access the port over telnet I can't figure out what the problem is. As a novice to both clojure and socket programming my best guess is that it has something to do with multiple threading--I know that both python and clojure create a new thread for each distinct socket. It's probably an incorrect guess. That's why I've decided to consult the community :D. Any help is appreciated in advance! -- -- 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. -- -- 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: Simple socket programming problem
It works! Wow, that was a simple solution! Thanks for the help :D :D. On Friday, May 31, 2013 9:04:42 PM UTC-4, atkaaz wrote: What happens if you send a newline after that Hello? ie. Hello\n since you're using read-line On Sat, Jun 1, 2013 at 3:44 AM, Andrew Spano werdn...@gmail.comjavascript: wrote: Hello, I'm trying to create a very simple interaction between a client and server program using the server-socket library which used to be part of clojure-contrib and is now maintained by technomancy https://github.com/technomancy/server-socket/blob/master/src/server/socket.clj I created a simple echo server, which works fine when accessed by telnet but can't seem to accept messages from the python client. This is the code for the client and the server: client.py: import socket s = socket.socket() host = socket.gethostname() port = 9001 s.connect((host,port)) while 1: s.send(Hello) print s.recv(1024) s.close() And this is the code for the server--I tried to capture all of the input into a vector, but the vector never seems to change: (ns bot-backend.core) (use 'server.socket) (import '(java.io BufferedReader InputStreamReader PrintWriter)) (def server (create-server 9001 (fn [in out] (binding [*in* (BufferedReader. (InputStreamReader. in)) *out* (PrintWriter. out)] (loop [input []] (println input) (recur (conj input (read-line The only output the client displays is a single empty vector after which it waits to receive more data. Since this works correctly when I access the port over telnet I can't figure out what the problem is. As a novice to both clojure and socket programming my best guess is that it has something to do with multiple threading--I know that both python and clojure create a new thread for each distinct socket. It's probably an incorrect guess. That's why I've decided to consult the community :D. Any help is appreciated in advance! -- -- 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: keys maps ... gak
Hi Ray, Perhaps this? user (let [desired-entity-names (set (map entity-names [:model :project]))] (select #(desired-entity-names (:entity %)) query-parts)) #{{:entity Model, :main-query select * from model where ...} {:entity Project, :main-query select * from project where ...}} All the best, Tj On Friday, May 31, 2013 10:18:09 PM UTC+2, mond wrote: Sometimes its just so frustrating when you know you are close but just cannot get that last little bit ... so I am appealing again for more newbie support I have a map for some names: user= (def entity-names {:project Project :model Model}) Which I then reference in a set of maps: user= def query-parts #{{:entity (entity-names :project ) :main-query select * from project where ... } {:entity (entity-names :model ) :main-query select * from model where ... }}) This query-parts is actually a large set. It will form the basis of execution and sometimes I want to execute a smaller set of the queries. So I want to be able to filter it based on a subset of the entity names, for example just :model. user= (select #(= (:model entity-names) (:entity %)) query-parts) #{{:entity Model, :main-query Model Query}} So that works great. But I would like a list of entities (:model :project :foo :bar) that represents a subset of the complete set of query parts. So I just (sic!) need some advice on how to run this select over a list of entity names rather than just the one shown above. I'm ashamed to say that I have spent an hour on this already so this is my white flag. I hope you can help. Thanks Ray -- -- 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] lein-pedantic is now deprecated
There seems to be enough desire to spend some more time on them. Issues filed at https://github.com/technomancy/leiningen/issues/1197 and https://github.com/technomancy/leiningen/issues/1198. I'll see about getting them into a future release. - Nelson Morris On Fri, May 31, 2013 at 7:54 PM, Curtis Gagliardi gagliardi.cur...@gmail.com wrote: Another +1 for those features. On Wednesday, May 29, 2013 6:25:22 PM UTC-7, Nelson Morris wrote: Good news everybody! As of leiningen 2.2.0 using `lein deps :tree` will perform version checks and version range detection. Therefore, I have deprecated lein-pedantic. I appreciate all of the users of the plugin that found it useful. I believe there are two pieces of functionality that do not currently have a replacement: 1) ability to fail the task when a bad dependency resolution happens 2) exact instructions of what to place in project.clj to make things work If you are interested in these, please let me know here, and I'll see about adding them in a future leiningen release. - Nelson Morris -- -- 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. -- -- 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.
gen-class - ClassNotFoundException
Hello All, What is wrong with the following usage? (I have this code in a file, and I'm calling clojure file) (ns com.me.HelloWorld (:gen-class)) (println (com.me.HelloWorld.)) I get a java.lang.ClassNotFoundException. -ramesh -- -- 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: [GSoC] core.matrix NDArray project feature requests
Hi Dmitry, One thing I've seen quite frequently in Clojure numerical code is some ugly code for manipulating Java arrays with areduce / aset / aget etc. It's one of the few areas where it's genuinely easier to write code in Java at the moment. So it would be awesome if the Clojure NDArray could make this kind of thing much easier by allowing users to wrap / unwrap Java arrays into a 1D NDArray. This would then enable Java arrays to be modified via the standard core.matrix API functions. Something like: (def arr (double-array [1 2 3 4 5])) (def ndarr (wrap-ndarray arr)) ;; wrap array as an NDArray ;; now use regular core.matrix functions to mutate the NDArray (add! ndarr 1.0) ;; add a scalar (mul! ndarr 2.0) ;; multiply by a scalar (sub! ndarr [0 0 0 4 8]) ;; subtract a vector (seq arr) = (4.0 6.0 8.0 6.0 4.0) (esum ndarr) ;; calculate sum of array elements = 28.0 Note that the wrapped array has been mutated in place. I think this approach would generally be much more readable, more convenient and less error prone than trying to code the equivalent operations with loop / recur / aset / aget / areduce etc. On Tuesday, 28 May 2013 16:25:49 UTC+8, Dmitry Groshev wrote: Hello, Clojurians. I was selected during GSoC process to implement a core.matrix-compatible NDArray in Clojure. More info about this project can be found at [1] and [2]. However, I would be really happy to know if there are any comments, wishes or feature requests regarding that proposals (please take note that there is also a clojurecheck / QuickCheck mention in my proposal) from you, the community, so I can plan ahead my commitment to the project. So, please, feel free to speak about your matrix- (or pure-function-testing-) related itches. [1] https://google-melange.appspot.com/gsoc/proposal/review/google/gsoc2013/si14/10001 [2] http://dev.clojure.org/display/community/Project+Ideas#ProjectIdeas-NDArrayImplementationinClojure -- -- 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.