Re: Question about sets
The new ticket CLJ-1065 has a patch that I think implements the desired behavior on the dev wiki page. i.e. set/map literals with duplicates are invalid (status quo) All constructor functions for sets and maps allow duplicates, and for maps, always take the value associated with the last occurrence of the same key. All constructor functions explicitly say this in their doc strings. Andy On Sep 7, 2012, at 2:06 PM, Rich Hickey wrote: On Sep 7, 2012, at 3:35 PM, Sean Corfield wrote: On Fri, Sep 7, 2012 at 10:49 AM, Rich Hickey richhic...@gmail.com wrote: I've added my feedback there (http://dev.clojure.org/display/design/Allow+duplicate+map+keys+and+set+elements) Thanx Rich! So the recommendation is: * set/map literals with duplicates are invalid (status quo) * hash-set/hash-map should change (to last key wins, as if conj'd/assoc'd) * sorted-set/sorted-map should not change (last key wins, as if conj'd/assoc'd) * array-map should not change (throws on dupes)? Highlighting that last one since it's not mentioned on the wiki and would then be the odd one out but perhaps there's a good reason? No, array-map should be the same too. -- 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: redefining multimethods at the repl
On Wed, Sep 5, 2012 at 12:31 AM, Brian Marick mar...@exampler.com wrote: I'm trying to write exercises for multimethods. Book readers will be working at the repl. Multimethods are stateful in a bad way, as shown below. Is there some sort of trick to using multimethods at the repl, or should I just give up on exercises using them? ;; Two types: user= (defn ship [name] (with-meta {:name name} {:type :ship})) user= (defn asteroid [name] (with-meta {:name name} {:type :asteroid})) ;; The dispatch function and defmulti user= (def classify-colliding-things (fn [thing1 thing2] [(type thing1) (type thing2)])) user= (defmulti collide classify-colliding-things) ;; Actually, since the arguments can come in any order, it'd be better to sort the types: user= (def classify-colliding-things (fn [thing1 thing2] (sort [(type thing1) (type thing2)]))) ;; And let's redefine the multimethod to use the new comparison function. user= (defmulti collide classify-colliding-things) ;; OK, now we define the methods. user= (defmethod collide [:asteroid :ship] [ things] collide asteroid to ship) ;;; And use them with great confidence: user= (collide (ship Space Beagle) (asteroid Malse)) IllegalArgumentException No method in multimethod 'collide' for dispatch value: [:ship :asteroid] clojure.lang.MultiFn.getFn (MultiFn.java:121) ;;; The redefinition didn't take here is a hack: define a var with the multimethod name: user (def collide nil) ; #'user/collide user (defmulti collide classify-colliding-things) ; #'user/collide user (defmethod collide [:asteroid :ship] [ things] collide asteroid to ship) ; #MultiFn clojure.lang.MultiFn@9fe5c5 user (collide (ship Space Beagle) (asteroid Malse)) ; collide asteroid to ship When writting multimethod I always preceed their definitions like this: ; remove existing definition (def mymulti nil) (defmulti mymulti ...) Also, I heard that this problem don't exists in nRepl (?) Denis - Brian Marick, Artisanal Labrador Contract programming in Ruby and Clojure Occasional consulting on Agile Writing /Functional Programming for the Object-Oriented Programmer/: https://leanpub.com/fp-oo -- 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: ANN Ritz 0.4.1
On Fri, Sep 7, 2012 at 9:11 PM, Hugo Duncan h...@hugoduncan.org wrote: Ritz is a collection of repl servers, middleware and repl utility functions, supporting nREPL and swank/slime. The repl utilities can be used from any repl. Does ritz/swank replace lein-swank? Thanks, Denis The 0.4.1 release is mainly a bug fix release. * Fixes an issue with in-ns not working correctly * Fixes jack-in support for ritz-swank * Fixes breakpoint support Many thanks to Jeff Palmucci and @cola_zero. Ritz is on github: https://github.com/pallet/ritz Hugo -- 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: Literate Programming in org-babel (ob-clojure.el) is broken under nrepl.el
On Thu, Sep 6, 2012 at 6:42 PM, lambdatronic gwjoh...@uvm.edu wrote: For those people (like myself) who do a lot of Literate Programming in Emacs using Clojure and org-babel, migrating to nrepl and nrepl.el is somewhat non-trivial. This is because the existing Clojure support in org-babel (ob-clojure.el) relies on slime and swank-clojure when running org-babel-execute-src-block (which redirects to org-babel-execute:clojure in ob-clojure.el). So clearly this is actually an issue for both nrepl.el and ob-clojure.el, not simply one or the other. All the same, I've hacked together a simple workaround that fixes the problem and makes Literate Programming under nrepl possible once again. If there is some slick way this could be worked into nrepl.el's codebase that wouldn't break its existing behavior (as this does), I'd be excited to see it. Here we go: ;; Patch result table rendering bug in ob-clojure (NREPL version) (defun nrepl-send-request-sync (request) Send a request to the backend synchronously (discouraged). The result is a plist with keys :value, :stderr and :stdout. (with-current-buffer *nrepl-connection* (setq nrepl-sync-response nil) (nrepl-send-request request (nrepl-sync-request-handler (current-buffer))) (while (not (plist-get nrepl-sync-response :done)) (accept-process-output)) nrepl-sync-response)) (defun org-babel-execute:clojure (body params) Execute a block of Clojure code with Babel. (let ((result-plist (nrepl-send-string-sync (org-babel-expand-body:clojure body params) nrepl-buffer-ns)) (result-type (cdr (assoc :result-type params (org-babel-script-escape (cond ((eq result-type 'value) (plist-get result-plist :value)) ((eq result-type 'output) (plist-get result-plist :value)) (t(message Unknown :results type!)) Have fun! It seems to be very interesting, I am already using Emacs / org-mode / clojure a lot, I was aware of org-babel, but never used it. Would you have a simple example project (on github, ...) on how to bootstrap this ? Thanks, Denis -- 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: [ANN] clojure-encog has a new name and repo
On Tue, Sep 4, 2012 at 9:05 PM, Jim - FooBar(); jimpil1...@gmail.comwrote: Hi all, just wanted to let you know that I renamed 'clojure-encog' to *enclog* ...release 0.5.0 does not add anything but several 'library coding standards' that i was previously not aware of, have been addressed... I created a brand new repo here : https://github.com/jimpil/enclog and a new jar here: https://clojars.org/enclog https://clojars.org/clojure-encog I also added a simple example of KMeans clustering and soon I will have the famous TSP problem solved... cheers, Jim Seems cool But when I tried to run the example: (let [xor-input [[0.0 0.0] [1.0 0.0] [0.0 0.1] [1.0 1.0]] xor-ideal [[0.0] [1.0] [1.0] [0.0]] dataset (data :basic-dataset xor-input xor-ideal) trainer ((trainer :back-prop) network dataset)]) I got : clojure.lang.MultiFn cannot be cast to org.encog.neural.networks.ContainsFlat [Thrown class java.lang.ClassCastException] Restarts: 0: [QUIT] Quit to the SLIME top level Backtrace: 0: training.clj:156 enclog.training/trainer[fn] 1: NO_SOURCE_FILE:1 clojure-station.lib-example.enclog/fn 2: AFn.java:159 clojure.lang.AFn.applyToHelper 3: AFn.java:151 clojure.lang.AFn.applyTo 4: Compiler.java:3382 clojure.lang.Compiler$InvokeExpr.eval 5: Compiler.java:398 clojure.lang.Compiler$DefExpr.eval 6: Compiler.java:6516 clojure.lang.Compiler.eval 7: Compiler.java:6477 clojure.lang.Compiler.eval 8: core.clj:2797 clojure.core/eval 9: core.clj:532 swank.core/eval786[fn] 10: MultiFn.java:163 clojure.lang.MultiFn.invoke 11: basic.clj:54 swank.commands.basic/eval-region 12: basic.clj:44 swank.commands.basic/eval-region 13: basic.clj:78 swank.commands.basic/eval1061[fn] 14: Var.java:415 clojure.lang.Var.invoke 15: (Unknown Source) clojure-station.lib-example.enclog/eval7620 16: Compiler.java:6511 clojure.lang.Compiler.eval 17: Compiler.java:6477 clojure.lang.Compiler.eval 18: core.clj:2797 clojure.core/eval 19: core.clj:100 swank.core/eval-in-emacs-package 20: core.clj:256 swank.core/eval-for-emacs 21: Var.java:423 clojure.lang.Var.invoke 22: AFn.java:167 clojure.lang.AFn.applyToHelper 23: Var.java:532 clojure.lang.Var.applyTo 24: core.clj:601 clojure.core/apply 25: core.clj:107 swank.core/eval-from-control 26: core.clj:112 swank.core/eval-loop 27: core.clj:341 swank.core/spawn-repl-thread[fn] 28: AFn.java:159 clojure.lang.AFn.applyToHelper 29: AFn.java:151 clojure.lang.AFn.applyTo 30: core.clj:601 clojure.core/apply 31: core.clj:338 swank.core/spawn-repl-thread[fn] 32:RestFn.java:397 clojure.lang.RestFn.invoke 33:AFn.java:24 clojure.lang.AFn.run 34:Thread.java:662 java.lang.Thread.run (I am on clojure 1.4.0) -- 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: Does moustache work with latest ring and clojure ?
Herwig/Marko, Below is the code - (def my-app (app wrap-stacktrace (wrap-file resources/public/) [] Hello World [/] Hello World Second [page] (- (chrome page) response constantly) [] (- Nothing was found response (status 404) constantly))) I am getting Hello world response on in the browser, but it also gives me an error in the server terminal. I have posted my code on https://github.com/murtaza52/mfaiz. Any ideas on what could be causing the error ? Thanks, Murtaza On Saturday, September 8, 2012 1:32:50 AM UTC+5:30, Marko Topolnik wrote: For the record, Moustache does support the special case of returning a literal string response: user (run-jetty (app [hi] Hello, world!\n) {:port :join? false}) $ curl localhost:/hi Hello, world! On Friday, September 7, 2012 7:06:42 PM UTC+2, Murtaza Husain wrote: Herwig, Thanks for the detailed answers below. Hi Murtaza, moustache handlers must be functions. So to return a string as a response, the last line would have to be [] (constantly Nothing was found) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [ANN] clojure-encog has a new name and repo
Hi Denis, you cannot bring 2 vars named 'network' in the same namespace...It is partly my fault cos since I changed 'make-network' to 'network' I should have changed the examples as well...try again but instead of 'network' define your neural-net as 'net' or something cos there is alaredy a 'network' multi-fn...in any case, I'm assuming you're just fooling around with enclog...if this is the case, keep in mind that i will push 0.5.2 later this afternoon which includes some changes...I'll try fix the examples as well... thanks for trying out enclog and for reporting what you thought was a bug... Jim On 08/09/12 10:12, Denis Labaye wrote: On Tue, Sep 4, 2012 at 9:05 PM, Jim - FooBar(); jimpil1...@gmail.com mailto:jimpil1...@gmail.com wrote: Hi all, just wanted to let you know that I renamed 'clojure-encog' to *enclog* ...release 0.5.0 does not add anything but several 'library coding standards' that i was previously not aware of, have been addressed... I created a brand new repo here : https://github.com/jimpil/enclog and a new jar here: https://clojars.org/enclog https://clojars.org/clojure-encog I also added a simple example of KMeans clustering and soon I will have the famous TSP problem solved... cheers, Jim Seems cool But when I tried to run the example: (let[xor-input [[0.0 0.0] [1.0 0.0] [0.0 0.1] [1.0 1.0]] xor-ideal [[0.0] [1.0] [1.0] [0.0]] dataset(data :basic-dataset xor-input xor-ideal) trainer((trainer :back-prop) network dataset)]) I got : clojure.lang.MultiFn cannot be cast to org.encog.neural.networks.ContainsFlat [Thrown class java.lang.ClassCastException] Restarts: 0: [QUIT] Quit to the SLIME top level Backtrace: 0: training.clj:156 enclog.training/trainer[fn] 1: NO_SOURCE_FILE:1 clojure-station.lib-example.enclog/fn 2: AFn.java:159 clojure.lang.AFn.applyToHelper 3: AFn.java:151 clojure.lang.AFn.applyTo 4: Compiler.java:3382 clojure.lang.Compiler$InvokeExpr.eval 5: Compiler.java:398 clojure.lang.Compiler$DefExpr.eval 6: Compiler.java:6516 clojure.lang.Compiler.eval 7: Compiler.java:6477 clojure.lang.Compiler.eval 8: core.clj:2797 clojure.core/eval 9: core.clj:532 swank.core/eval786[fn] 10: MultiFn.java:163 clojure.lang.MultiFn.invoke 11: basic.clj:54 swank.commands.basic/eval-region 12: basic.clj:44 swank.commands.basic/eval-region 13: basic.clj:78 swank.commands.basic/eval1061[fn] 14: Var.java:415 clojure.lang.Var.invoke 15: (Unknown Source) clojure-station.lib-example.enclog/eval7620 16: Compiler.java:6511 clojure.lang.Compiler.eval 17: Compiler.java:6477 clojure.lang.Compiler.eval 18: core.clj:2797 clojure.core/eval 19: core.clj:100 swank.core/eval-in-emacs-package 20: core.clj:256 swank.core/eval-for-emacs 21: Var.java:423 clojure.lang.Var.invoke 22: AFn.java:167 clojure.lang.AFn.applyToHelper 23: Var.java:532 clojure.lang.Var.applyTo 24: core.clj:601 clojure.core/apply 25: core.clj:107 swank.core/eval-from-control 26: core.clj:112 swank.core/eval-loop 27: core.clj:341 swank.core/spawn-repl-thread[fn] 28: AFn.java:159 clojure.lang.AFn.applyToHelper 29: AFn.java:151 clojure.lang.AFn.applyTo 30: core.clj:601 clojure.core/apply 31: core.clj:338 swank.core/spawn-repl-thread[fn] 32: RestFn.java:397 clojure.lang.RestFn.invoke 33: AFn.java:24 clojure.lang.AFn.run 34: Thread.java:662 java.lang.Thread.run (I am on clojure 1.4.0) -- 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%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ANN Ritz 0.4.1
Denis Labaye denis.lab...@gmail.com writes: On Fri, Sep 7, 2012 at 9:11 PM, Hugo Duncan h...@hugoduncan.org wrote: Ritz is a collection of repl servers, middleware and repl utility functions, supporting nREPL and swank/slime. The repl utilities can be used from any repl. Does ritz/swank replace lein-swank? The equivalent of lein-swank is lein-ritz [1]. At the moment there is no simple way of starting ritz without the debugger (`lein ritz 4005 localhost :server-ns ritz.swank.repl` is the not so simple way of doing this). The jack-in instructions should probably also be given more prominence in the README. Hugo [1] https://github.com/pallet/ritz/tree/develop/swank -- 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: Question about sets
Thanks! I'm still interested in patch for recommendation #3: Restore the fastest path possible for those cases where the keys are compile-time detectable unique constants I'd like to see all three recommendations go into a release as a set. On Sep 8, 2012, at 2:22 AM, Andy Fingerhut wrote: The new ticket CLJ-1065 has a patch that I think implements the desired behavior on the dev wiki page. i.e. set/map literals with duplicates are invalid (status quo) All constructor functions for sets and maps allow duplicates, and for maps, always take the value associated with the last occurrence of the same key. All constructor functions explicitly say this in their doc strings. Andy On Sep 7, 2012, at 2:06 PM, Rich Hickey wrote: On Sep 7, 2012, at 3:35 PM, Sean Corfield wrote: On Fri, Sep 7, 2012 at 10:49 AM, Rich Hickey richhic...@gmail.com wrote: I've added my feedback there (http://dev.clojure.org/display/design/Allow+duplicate+map+keys+and+set+elements) Thanx Rich! So the recommendation is: * set/map literals with duplicates are invalid (status quo) * hash-set/hash-map should change (to last key wins, as if conj'd/assoc'd) * sorted-set/sorted-map should not change (last key wins, as if conj'd/assoc'd) * array-map should not change (throws on dupes)? Highlighting that last one since it's not mentioned on the wiki and would then be the odd one out but perhaps there's a good reason? No, array-map should be the same too. -- 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: edn
Michael Fogus mefo...@gmail.com writes: Data formats do not exist in a vacuum. They are parsed by languages. Some may have a fine-grained distinction between lists, arrays/vectors and sets and some may not. The concern I have is for someone wanting to define a format atop EDN -- or, to put it differently, to define a schema for it. If we want to define a structure to be represented in EDN such as a list of a person's favorite colors, on what basis would the schema author choose between list and vector notation? Is there a higher-level abstract type that he specify and require that a conforming processor accept either a list or vector literal? Even if he could mandate that, say, the favorite color list is of type sequence -- listed in descending order of preference -- then an author creating the EDN to represent such a person again has to make a choice between a list and a vector, again without a clear basis for his decision. As an appeal to prior art, Rivest's S-Expressions Internet-Draft¹ used only a single list structure, though it does define three different encodings for that structure. Footnotes: ¹ http://people.csail.mit.edu/rivest/Sexp.txt -- Steven E. Harris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [ANN] clojure-encog has a new name and repo
Hi Denis, as promised, I pushed enclog 0.5.2-SNAPSHOT to clojars 5 minutes ago and updated the demo examples on github to show the new code style. tested all the examples and everything works just fine...if you find anything unusual feel free to poke me :-) aaa btw 0.5.2 has nice documentation as well (well, nicer anyway) and also fixed a small bug with SVM/PNN initialisation. you shouldn't have any problems copy-pasting the examples now even if you're :using the entire 'networks' namespace...it is better to :require it though so you can choose your own names. hope that helps... Jim On 08/09/12 13:00, Jim - FooBar(); wrote: Hi Denis, you cannot bring 2 vars named 'network' in the same namespace...It is partly my fault cos since I changed 'make-network' to 'network' I should have changed the examples as well...try again but instead of 'network' define your neural-net as 'net' or something cos there is alaredy a 'network' multi-fn...in any case, I'm assuming you're just fooling around with enclog...if this is the case, keep in mind that i will push 0.5.2 later this afternoon which includes some changes...I'll try fix the examples as well... thanks for trying out enclog and for reporting what you thought was a bug... Jim On 08/09/12 10:12, Denis Labaye wrote: On Tue, Sep 4, 2012 at 9:05 PM, Jim - FooBar(); jimpil1...@gmail.com mailto:jimpil1...@gmail.com wrote: Hi all, just wanted to let you know that I renamed 'clojure-encog' to *enclog* ...release 0.5.0 does not add anything but several 'library coding standards' that i was previously not aware of, have been addressed... I created a brand new repo here : https://github.com/jimpil/enclog and a new jar here: https://clojars.org/enclog https://clojars.org/clojure-encog I also added a simple example of KMeans clustering and soon I will have the famous TSP problem solved... cheers, Jim Seems cool But when I tried to run the example: (let[xor-input [[0.0 0.0] [1.0 0.0] [0.0 0.1] [1.0 1.0]] xor-ideal [[0.0] [1.0] [1.0] [0.0]] dataset(data :basic-dataset xor-input xor-ideal) trainer((trainer :back-prop) network dataset)]) I got : clojure.lang.MultiFn cannot be cast to org.encog.neural.networks.ContainsFlat [Thrown class java.lang.ClassCastException] Restarts: 0: [QUIT] Quit to the SLIME top level Backtrace: 0: training.clj:156 enclog.training/trainer[fn] 1: NO_SOURCE_FILE:1 clojure-station.lib-example.enclog/fn 2: AFn.java:159 clojure.lang.AFn.applyToHelper 3: AFn.java:151 clojure.lang.AFn.applyTo 4: Compiler.java:3382 clojure.lang.Compiler$InvokeExpr.eval 5: Compiler.java:398 clojure.lang.Compiler$DefExpr.eval 6: Compiler.java:6516 clojure.lang.Compiler.eval 7: Compiler.java:6477 clojure.lang.Compiler.eval 8: core.clj:2797 clojure.core/eval 9: core.clj:532 swank.core/eval786[fn] 10: MultiFn.java:163 clojure.lang.MultiFn.invoke 11: basic.clj:54 swank.commands.basic/eval-region 12: basic.clj:44 swank.commands.basic/eval-region 13: basic.clj:78 swank.commands.basic/eval1061[fn] 14: Var.java:415 clojure.lang.Var.invoke 15: (Unknown Source) clojure-station.lib-example.enclog/eval7620 16: Compiler.java:6511 clojure.lang.Compiler.eval 17: Compiler.java:6477 clojure.lang.Compiler.eval 18: core.clj:2797 clojure.core/eval 19: core.clj:100 swank.core/eval-in-emacs-package 20: core.clj:256 swank.core/eval-for-emacs 21: Var.java:423 clojure.lang.Var.invoke 22: AFn.java:167 clojure.lang.AFn.applyToHelper 23: Var.java:532 clojure.lang.Var.applyTo 24: core.clj:601 clojure.core/apply 25: core.clj:107 swank.core/eval-from-control 26: core.clj:112 swank.core/eval-loop 27: core.clj:341 swank.core/spawn-repl-thread[fn] 28: AFn.java:159 clojure.lang.AFn.applyToHelper 29: AFn.java:151 clojure.lang.AFn.applyTo 30: core.clj:601 clojure.core/apply 31: core.clj:338 swank.core/spawn-repl-thread[fn] 32: RestFn.java:397 clojure.lang.RestFn.invoke 33: AFn.java:24 clojure.lang.AFn.run 34: Thread.java:662 java.lang.Thread.run (I am on clojure 1.4.0) -- 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%2bunsubscr...@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
Re: [ANN] clojure-encog has a new name and repo
On Sat, Sep 8, 2012 at 2:00 PM, Jim - FooBar(); jimpil1...@gmail.comwrote: Hi Denis, you cannot bring 2 vars named 'network' in the same namespace... I choose another name for the network, but even with that I got the clojure.lang.MultiFn cannot be cast to org.encog.neural.networks.ContainsFlat (I just copied pasted the example from the website in my answer message). Anyway, it works fine with the 0.5.2-SNAPSHOT (I've got network traing logs), but how do I use the network I just trained ? In your example I would like to give it a new input, and see if it learned correctly his xor lesson :) Denis It is partly my fault cos since I changed 'make-network' to 'network' I should have changed the examples as well...try again but instead of 'network' define your neural-net as 'net' or something cos there is alaredy a 'network' multi-fn...in any case, I'm assuming you're just fooling around with enclog...if this is the case, keep in mind that i will push 0.5.2 later this afternoon which includes some changes...I'll try fix the examples as well... thanks for trying out enclog and for reporting what you thought was a bug... Jim On 08/09/12 10:12, Denis Labaye wrote: On Tue, Sep 4, 2012 at 9:05 PM, Jim - FooBar(); jimpil1...@gmail.comwrote: Hi all, just wanted to let you know that I renamed 'clojure-encog' to *enclog* ...release 0.5.0 does not add anything but several 'library coding standards' that i was previously not aware of, have been addressed... I created a brand new repo here : https://github.com/jimpil/enclog and a new jar here: https://clojars.org/enclog https://clojars.org/clojure-encog I also added a simple example of KMeans clustering and soon I will have the famous TSP problem solved... cheers, Jim Seems cool But when I tried to run the example: (let [xor-input [[0.0 0.0] [1.0 0.0] [0.0 0.1] [1.0 1.0]] xor-ideal [[0.0] [1.0] [1.0] [0.0]] dataset (data :basic-dataset xor-input xor-ideal) trainer ((trainer :back-prop) network dataset)]) I got : clojure.lang.MultiFn cannot be cast to org.encog.neural.networks.ContainsFlat [Thrown class java.lang.ClassCastException] Restarts: 0: [QUIT] Quit to the SLIME top level Backtrace: 0: training.clj:156 enclog.training/trainer[fn] 1: NO_SOURCE_FILE:1 clojure-station.lib-example.enclog/fn 2: AFn.java:159 clojure.lang.AFn.applyToHelper 3: AFn.java:151 clojure.lang.AFn.applyTo 4: Compiler.java:3382 clojure.lang.Compiler$InvokeExpr.eval 5: Compiler.java:398 clojure.lang.Compiler$DefExpr.eval 6: Compiler.java:6516 clojure.lang.Compiler.eval 7: Compiler.java:6477 clojure.lang.Compiler.eval 8: core.clj:2797 clojure.core/eval 9: core.clj:532 swank.core/eval786[fn] 10: MultiFn.java:163 clojure.lang.MultiFn.invoke 11: basic.clj:54 swank.commands.basic/eval-region 12: basic.clj:44 swank.commands.basic/eval-region 13: basic.clj:78 swank.commands.basic/eval1061[fn] 14: Var.java:415 clojure.lang.Var.invoke 15: (Unknown Source) clojure-station.lib-example.enclog/eval7620 16: Compiler.java:6511 clojure.lang.Compiler.eval 17: Compiler.java:6477 clojure.lang.Compiler.eval 18: core.clj:2797 clojure.core/eval 19: core.clj:100 swank.core/eval-in-emacs-package 20: core.clj:256 swank.core/eval-for-emacs 21: Var.java:423 clojure.lang.Var.invoke 22: AFn.java:167 clojure.lang.AFn.applyToHelper 23: Var.java:532 clojure.lang.Var.applyTo 24: core.clj:601 clojure.core/apply 25: core.clj:107 swank.core/eval-from-control 26: core.clj:112 swank.core/eval-loop 27: core.clj:341 swank.core/spawn-repl-thread[fn] 28: AFn.java:159 clojure.lang.AFn.applyToHelper 29: AFn.java:151 clojure.lang.AFn.applyTo 30: core.clj:601 clojure.core/apply 31: core.clj:338 swank.core/spawn-repl-thread[fn] 32:RestFn.java:397 clojure.lang.RestFn.invoke 33:AFn.java:24 clojure.lang.AFn.run 34:Thread.java:662 java.lang.Thread.run (I am on clojure 1.4.0) -- 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
Re: [ANN] clojure-encog has a new name and repo
On 08/09/12 16:56, Denis Labaye wrote: Anyway, it works fine with the 0.5.2-SNAPSHOT (I've got network traing logs), but how do I use the network I just trained ? In your example I would like to give it a new input, and see if it learned correctly his xor lesson :) basically, you need to make the dataset you want and then do something like the following: (doseq [pair dataset] (let [output (.compute network (.getInput pair))] ;;test the network (println (.getData (.getInput pair) 0) , (. (. pair getInput) getData 1) , actual= (.getData output 0) , ideal= (.getData (.getIdeal pair) 0 conveniently, there is a evaluate macro to hide all that in the training namespace... so what I would do is this: (let [xor-alt-input [[2.0 2.0] [0.0 0.0] [2.0 0.0] [0.0 2.0]] ;;your alternative input xor-alt-ideal [[0.0] [0.0] [1.0] [1.0]] ;;the ideal for your input dataset (data :basic-dataset xor-alt-input xor-alt-ideal)] (evaluate network dataset)) ;as usual Jim ps: the xor problem is really a toy example - all the possible combinations already exist in the training data...there is no way really to generate your own input that the network has not seen. look in examples.clj for some examples...there is also a main fn that will run all the examples... -- 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: edn
I'd say on the basis of convenience, since we get to serialize and deserialize for free (o with customizations), and for most cases the author on both ends is likely to be the same person or team. For other languages, producers don't work any harder either way, and consumers are free to interpret both the schema and data as they need. sexp's only have a list notation because that's all lisp had, and even then, some people got it all for free. On Saturday, September 8, 2012 6:29:06 AM UTC-7, Steven E. Harris wrote: Michael Fogus mef...@gmail.com javascript: writes: Data formats do not exist in a vacuum. They are parsed by languages. Some may have a fine-grained distinction between lists, arrays/vectors and sets and some may not. The concern I have is for someone wanting to define a format atop EDN -- or, to put it differently, to define a schema for it. If we want to define a structure to be represented in EDN such as a list of a person's favorite colors, on what basis would the schema author choose between list and vector notation? Is there a higher-level abstract type that he specify and require that a conforming processor accept either a list or vector literal? Even if he could mandate that, say, the favorite color list is of type sequence -- listed in descending order of preference -- then an author creating the EDN to represent such a person again has to make a choice between a list and a vector, again without a clear basis for his decision. As an appeal to prior art, Rivest's S-Expressions Internet-Draft¹ used only a single list structure, though it does define three different encodings for that structure. Footnotes: ¹ http://people.csail.mit.edu/rivest/Sexp.txt -- Steven E. Harris -- 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: Bug in CLJS `symbol` with quoted symbol
On Sat, Sep 8, 2012 at 1:50 AM, Shantanu Kumar kumar.shant...@gmail.com wrote: Hello, I found this bug related to `symbol` and quoted symbols in CLJS. Explained below. In Clojure: user= (= 'a (symbol 'a)) true In CLJS: ClojureScript:cljs.user (= 'a (symbol 'a)) false Unless this is related to http://dev.clojure.org/jira/browse/CLJS-376 I can file a new issue for this. Somebody please let me know. Shantanu Not related, but it looks like another bug :) David -- 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: Bug in CLJS `symbol` with quoted symbol
On Sat, Sep 8, 2012 at 1:50 AM, Shantanu Kumar kumar.shant...@gmail.com wrote: In CLJS: ClojureScript:cljs.user (= 'a (symbol 'a)) false Shantanu Fixed in master. -- 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: Bug in CLJS `symbol` with quoted symbol
On Saturday, 8 September 2012 23:36:49 UTC+5:30, David Nolen wrote: On Sat, Sep 8, 2012 at 1:50 AM, Shantanu Kumar kumar.s...@gmail.comjavascript: wrote: In CLJS: ClojureScript:cljs.user (= 'a (symbol 'a)) false Shantanu Fixed in master. Thanks! Shantanu -- 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: edn
On Fri, Sep 7, 2012 at 3:01 AM, Rich Hickey richhic...@gmail.com wrote: I've started to document a subset of Clojure's data format in an effort to get it more widely used as a data exchange format, e.g. as an alternative to JSON. Please have a look: https://github.com/richhickey/edn If - or . are the first character, the second character must be non-numeric. Additionally, : # are allowed as constituent characters in symbols but not as the first character. So, is foo/-4bar allowed or not? It would seem allowed, but this has the unfortunate property that the we're left with an unreadable symbol if we strip the prefix: -4bar. I follow forbidding -4bar since that means potentially unbounded look-ahead to distinguish numbers from non-numbers. Presumably forbidding .4bar is for the same reason, though .01 doesn't appear to be a valid numeric literal. (Numeric literals all start with a digit.) // Ben -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: edn
Ben Smith-Mannschott bsmith.o...@gmail.com writes: I follow forbidding -4bar since that means potentially unbounded look-ahead to distinguish numbers from non-numbers. Presumably forbidding .4bar is for the same reason, though .01 doesn't appear to be a valid numeric literal. (Numeric literals all start with a digit.) Common Lisp provides useful precedent with its notion of potential numbers¹. If we stretch the analogy of namespace syntax to Common Lisp package syntax, clause 3 in HyperSpec section 2.3.1.1² -- Potential Numbers as Tokens -- is relevant to your cases above. ,[ §2.3.1.1 ] | 3. The token begins with a digit, sign, decimal point, or extension |character, but not a package marker. The syntax involving a leading |package marker followed by a potential number is not |well-defined. The consequences of the use of notation such as :1, |:1/2, and :2^3 in a position where an expression appropriate for read |is expected are unspecified. ` Well, I suppose that's precluding using the package marker without an actual package name ahead of it, like using '/' without a namespace name before it. In any case, Common Lisp parses both -4bar and .4bar as symbols: , | * (loop for s in '(-4bar .4bar) collect (type-of (read-from-string s))) | (SYMBOL SYMBOL) ` Footnotes: ¹ http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_p.htm#potential_number ² http://www.lispworks.com/documentation/HyperSpec/Body/02_caa.htm -- Steven E. Harris -- 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: edn
Armando Blancas abm221...@gmail.com writes: I'd say on the basis of convenience, since we get to serialize and deserialize for free (o with customizations), and for most cases the author on both ends is likely to be the same person or team. I find that to be a specious defense. If we expect the same author to be on both ends of the wire or reading the files he wrote himself, why take interest in such a specified format anyway? For other languages, producers don't work any harder either way, and consumers are free to interpret both the schema and data as they need. It sounds like you've ignored the thrust of my concern rather than settling it. sexp's only have a list notation because that's all lisp had, and even then, some people got it all for free. That tail did not wag that dog. -- Steven E. Harris -- 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: algo.monad state-m fetch-val bug and efficiency issue
On Sat, 2012-09-08 at 07:39 +0200, Phlex wrote: I was unable to contact a maintainer of this library on irc I suggest using http://dev.clojure.org/jira/browse/ALGOM to report algo.monads bugs. https://gist.github.com/3667614 -(key s))) ;; only works for keyword keys +(key s))) ;; works for arbitrary functions As to the second issue, if you're worried about efficiency, a more general solution might be appropriate: one capable of expressing inlining for m-result and m-bind. Right now, you can always get efficiency by writing out your state monadic values rather than using the abstractions. -- Stephen Compall ^aCollection allSatisfy: [:each | aCondition]: less is better than -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Can't start Rhino repl for ClojureScript
Hi, Any help wd be appreciated; this is what happened (environment is Cygwin on win7): $ lein2 trampoline cljsbuild repl-rhino Running Rhino-based ClojureScript REPL. (do (require (quote cljsbuild.repl.rhino)) (do (clojure.core/ns leiningen.core.injected) (defn- compose-hooks [f1 f2] (fn [ args] (apply f2 f1 args))) (defn- join-hooks [original hooks] (reduce compose-hooks original hooks)) (defn- run-hooks [hook original args] (apply (join-hooks original (clojure.core/deref hook)) args)) (defn- prepare-for-hooks [v] (when-not (:robert.hooke/hook (meta (clojure.core/deref v))) (let [hook (atom ())] (alter-var-root v (fn [original] (with-meta (fn [ args] (run-hooks hook original args)) (assoc (meta original) :robert.hooke/hook hook :robert.hooke/original original))) (defn- add-unless-present [coll f] (if-not (some #{f} coll) (conj coll f) coll)) (defn add-hook \Add a hook function f to target-var. Hook functions are passed the\\n target function and all their arguments and must apply the target to\\n the args if they wish to continue execution.\ [target-var f] (prepare-for-hooks target-var) (swap! (:robert.hooke/hook (meta (clojure.core/deref target-var))) add-unless-present f)) (clojure.core/ns user)) (set! *warn-on-reflection* nil) (do (cljsbuild.repl.rhino/run-repl-rhino) (clojure.core/shutdown-agents))) $ -A -- 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: algo.monad state-m fetch-val bug and efficiency issue
You sir are nitpicking on me ! On 9/09/2012 02:05, Stephen Compall wrote: https://gist.github.com/3667614 -(key s))) ;; only works for keyword keys +(key s))) ;; works for arbitrary functions You of course are right, the key parameter could be a function and this might be useful in some cases. But that is not the *contract* of the fetch-val function. the docstring explicitly says that the state is a map and that the function returns the value corresponding to this key. This does break for a string or integer key. There is no way around it, this is a bug. As to the second issue, if you're worried about efficiency, a more general solution might be appropriate: one capable of expressing inlining for m-result and m-bind. Right now, you can always get efficiency by writing out your state monadic values rather than using the abstractions. This function stands alone in the state-m library in showing such an efficiency issue. One can see that great care was taken to make algo.monad efficient. I for one am very pleased about its performances. I'm merely asking to bring this single function up to par with its state-m friends. You'll notice that my preferred solution uses the same coding style as the rest of the state-m functions. Thanks for the JIRA link, I'm really not in the loop with these things. Sacha -- 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: algo.monad state-m fetch-val bug and efficiency issue
On Sun, 2012-09-09 at 03:33 +0200, Phlex wrote: the docstring explicitly says that the state is a map and that the function returns the value corresponding to this key. This does break for a string or integer key. There is no way around it, this is a bug. Sure, but a documentation bug, or a behavioral one? I would say the former; we are, after all, in a context in which functions have primacy over maps. -- Stephen Compall ^aCollection allSatisfy: [:each | aCondition]: less is better than -- 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