Re: Literate Programming example
On 11/20/2011 11:18 PM, Daniel Jomphe wrote: On Sunday, November 20, 2011 5:50:31 AM UTC-5, thorwil wrote: I'm following one or the other Free Software project where an incredible amount of discussions happen regarding work-flow and features. So much thought, so many decisions on details, but for the most part, the implementation is all that remains. But the research, concepts and conscious decisions regarding trade-offs could actually outlive any implementation, they are portable and could be argued to be more valuable. You raised my curiosity. Would you mind sharing a link? ;) My prime example would be Ardour (ardour.org). Almost all the action happens on IRC, where the lead developer has many interactions with a few other coders and users, among them professional sound-engineers who provide critical insight into certain scenarios/work-flows and the features of related hard-and software. Starting to be off-topic, so this is as far as I will take it on this list ;) -- Thorsten Wilms thorwil's design for free software: http://thorwil.wordpress.com/ -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
clojure.java.io/reader vs clojure.stacktrace/print-cause-trace call
Hello clojure-users, Using API documentation on a page: http://clojure.github.com/clojure/clojure.stacktrace-api.html I am doing different function calls. (clojure.java.io/reader path) works just fine. But, (clojure.stacktrace/print-cause-trace e) gives me an error message during compilation: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.stacktrace ! What's wrong? Thanks in advance. Sincerely, Ru -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Probabilistic programming in clojure
Hi Jeff, good idea to move this over to clojure 1.3. I have just included your patch. On Nov 20, 5:32 am, Jeff Rose ros...@gmail.com wrote: Cool! I experimented a little bit with Church a while back, but having something like this in Clojure could be really interesting. I don't have much experience with sampling, but if I understand it correctly, your grass-is-wet demo is defining a belief network where each sample taken represents the complete state of the graph, or just the final outcome? What does a sample look like? It would be great if we could use this kind of generative model to create chord sequences, melodies, and rhythms for Overtone. I don't know what kinds of choice points would be appropriate, or if we could train them based on a database of existing progressions? The grass-is-wet demo indeed specifies a belief network. In contrast to Church, the definition of the model, conditioning on observations and specifying the output variables is all done in one path. This works exactly like the probability monad in clojure.contrib. Thus, each sample corresponds to an outcome of the output variables, i.e. rain in the example. Since the model is conditioned on grass-is-wet = true, using m-zero of the monad implements rejection sampling, you obtain samples of the posterior distribution p(rain | grass-is-wet = true). In principle it should be possible to use it for generative models of music. Since I'm not an expert in this area, I don't know which kind of models and probability distributions are useful to describe musical structure. Let me know if you have an idea, I would be happy to help putting it into clojure. Best, Nils -Jeff On Nov 18, 12:57 am, Nils Bertschinger nils.bertschin...@googlemail.com wrote: Hi everyone, inspired by the bher compiler for the probabilistic scheme dialect MIT Church, I have implemented a version of the probability monad which uses Metropolis Hastings to draw samples from runs of monadic programs. You can find the code on github:https://github.com/bertschi/ProbClojureNice. The monadic version is more a proof of principle and not very fast. It might nevertheless be useful, e.g. for educational purposes. Have a look and decide for yourself ... For the future, I'm working on a different approach to embed probabilistic operations into clojure which scales better and allows to run somewhat larger models. Any comments and feedback are welcome. Best, Nils -- 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: Probabilistic programming in clojure
Hi Julius, good catch, I don't know how I missed that??? Just uploaded a fix ... should work now. Nils On Nov 20, 5:58 pm, Julius Seporaitis jul...@seporaitis.net wrote: Hello guys, I would like to try out this library, but ran into a problem with Clojure 1.3, 'lein repl' throws an exception, when: *user= (use 'probabilistic-clojure.monadic.demos)* *user= (test-mixture mixture-mem) * *Trying to find valid trace ...* *Starting MH-sampling.* *IllegalArgumentException No value supplied for key: 0.7 clojure.lang.PersistentHashMap.createWithCheck (PersistentHashMap.java:89)* I am a total beginner with Clojure, if you could provide a at least a hint of how to resolve this - I'd appreciate it. P.S. I am using the 1.3 branch by Jeff, that works with Leiningen. Thanks! - Julius -- 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
Explanation of with-resource
Hi Clojurians! Please could somebody explain the code highlighted expression below to me? (Adapted from *The Joy of Clojure*, listing 8.9) (defmacro with-resource [bindings close-fn body] `(let ~bindings (try ~@body (finally (~close-fn ~(bindings 0)) I've changed the name of the variable from binding to bindings as I originally thought this was calling the function binding! I've also removed the redundant do loop. Using macroexpand-1 on the code yields the following: user (macroexpand-1 '(with-resource [x 1] #(println %))) (clojure.core/let [x 1] (try (finally ((fn* [p1__1605#] (println p1__1605#)) x It seems like the highlighted expression is indexing into the let vector at position 0. Neat trick, but this doesn't seem to work when multiple variables are being bound by the let. So how would one modify with-resource to call close-fn with multiple variables? Regards, Ralph -- 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: Explanation of with-resource
Hi, (defmacro with-resources [bindings close-fn body] (let [[x v more] bindings] `(let [~x ~v] (try ~(if-let [more (seq more)] `(with-resources ~more ~close-fn ~@body) `(do ~@body)) (finally (~close-fn ~x)) user= (macroexpand-1 '(with-resources [x 1] close foo bar)) (clojure.core/let [x 1] (try (do foo bar) (finally (close x user= (macroexpand-1 '(with-resources [x 1 y 2] close foo bar)) (clojure.core/let [x 1] (try (user/with-resources (y 2) close foo bar) (finally (close x You can call with-resource recursively. This has the added benefit of closing the resources in reverse order. Sincerely Meikel -- 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 build clojure cloned from github - 2 tests failed - when running from cygwin
Hi! When running ant command in cygwin on content cloned from http://github.com/clojure/clojure.git I get 2 errors: [java] Testing clojure.test-clojure.java.io [java] [java] ERROR in (test-streams-defaults) (FileOutputStream.java:-2) [java] expected: (= content (do (spit (.toURI f) content :encoding UTF-8) (slurp (.toURI f) :encoding UTF-8))) [java] actual: java.io.FileNotFoundException: C:\Documents%20and %20Settings\mjaaka\clojure.java.io5093958105426009259test-reader- writer (System nie może odnaleźć określonej ścieżki) [java] at java.io.FileOutputStream.open (FileOutputStream.java:-2) [java] java.io.FileOutputStream.init (FileOutputStream.java: 194) [java] clojure.java.io/fn (io.clj:224) [java] clojure.java.io$fn__7808$G__7784__7815.invoke (io.clj: 63) [java] clojure.java.io/fn (io.clj:236) [java] clojure.java.io$fn__7808$G__7784__7815.invoke (io.clj: 63) [java] clojure.java.io/fn (io.clj:243) [java] clojure.java.io$fn__7808$G__7784__7815.invoke (io.clj: 63) [java] clojure.java.io/fn (io.clj:160) [java] clojure.java.io$fn__7834$G__7788__7841.invoke (io.clj: 63) [java] clojure.java.io$writer.doInvoke (io.clj:113) [java] clojure.lang.RestFn.applyTo (RestFn.java:139) [java] clojure.core$apply.invoke (core.clj:602) [java] clojure.core$spit.doInvoke (core.clj:6041) [java] clojure.lang.RestFn.invoke (RestFn.java:464) [java] clojure.test_clojure.java.io$fn__7581$fn__7598.invoke (io.clj:42) [java] clojure.test_clojure.java.io/fn (io.clj:42) [java] clojure.test$test_var$fn__6484.invoke (test.clj:693) [java] clojure.test$test_var.invoke (test.clj:693) [java] clojure.test$test_all_vars$fn__6488$fn__6495.invoke (test.clj:709) [java] clojure.test$default_fixture.invoke (test.clj:663) [java] clojure.test$test_all_vars$fn__6488.invoke (test.clj: 709) [java] clojure.test$default_fixture.invoke (test.clj:663) [java] clojure.test$test_all_vars.invoke (test.clj:705) [java] clojure.test$test_ns.invoke (test.clj:728) [java] clojure.core$map$fn__3811.invoke (core.clj:2431) [java] clojure.lang.LazySeq.sval (LazySeq.java:42) [java] clojure.lang.LazySeq.seq (LazySeq.java:60) [java] clojure.lang.Cons.next (Cons.java:39) [java] clojure.lang.RT.boundedLength (RT.java:1607) [java] clojure.lang.RestFn.applyTo (RestFn.java:130) [java] clojure.core$apply.invoke (core.clj:602) [java] clojure.test$run_tests.doInvoke (test.clj:743) [java] clojure.lang.RestFn.applyTo (RestFn.java:137) [java] clojure.core$apply.invoke (core.clj:600) [java] clojure.test_clojure$eval20599.invoke (run_tests.clj: 59) [java] clojure.lang.Compiler.eval (Compiler.java:6498) [java] clojure.lang.Compiler.load (Compiler.java:6935) [java] clojure.lang.Compiler.loadFile (Compiler.java:6896) [java] clojure.main$load_script.invoke (main.clj:282) [java] clojure.main$script_opt.invoke (main.clj:342) [java] clojure.main$main.doInvoke (main.clj:426) [java] clojure.lang.RestFn.invoke (RestFn.java:408) [java] clojure.lang.Var.invoke (Var.java:401) [java] clojure.lang.AFn.applyToHelper (AFn.java:161) [java] clojure.lang.Var.applyTo (Var.java:518) [java] clojure.main.main (main.java:37) [java] [java] ERROR in (test-input-stream) (FileInputStream.java:-2) [java] Uncaught exception, not in assertion. [java] expected: nil [java] actual: java.io.FileNotFoundException: C:\Documents%20and %20Settings\mjaaka\test-input-stream7006412293390645280txt (System nie może odnaleźć określonej ścieżki) [java] at java.io.FileInputStream.open (FileInputStream.java:-2) [java] java.io.FileInputStream.init (FileInputStream.java: 120) [java] java.io.FileInputStream.init (FileInputStream.java: 79) [java] clojure.java.io/fn (io.clj:232) [java] clojure.java.io$fn__7821$G__7786__7828.invoke (io.clj: 63) [java] clojure.java.io/fn (io.clj:242) [java] clojure.java.io$fn__7821$G__7786__7828.invoke (io.clj: 63) [java] clojure.java.io$input_stream.doInvoke (io.clj:130) [java] clojure.lang.RestFn.invoke (RestFn.java:410) [java] clojure.test_clojure.java.io/fn (io.clj:169) [java] clojure.test$test_var$fn__6484.invoke (test.clj:693) [java] clojure.test$test_var.invoke (test.clj:693) [java] clojure.test$test_all_vars$fn__6488$fn__6495.invoke (test.clj:709) [java] clojure.test$default_fixture.invoke (test.clj:663) [java] clojure.test$test_all_vars$fn__6488.invoke (test.clj: 709) [java] clojure.test$default_fixture.invoke (test.clj:663) [java] clojure.test$test_all_vars.invoke (test.clj:705)
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
Hmmm... When trying to do http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html especially Add the following: (defproject test-project 0.1.0 :description Test Project :dependencies [[org.clojure/clojure 1.3.0] [org.clojure/clojure-contrib 1.2.0]] :dev-dependencies [[swank-clojure 1.2.1]]) Save and exit the file. ~$ lein deps ~$ lein swank there is an exception about not finding print-doc Any help? Emacs/swank thing is a nightmare. I wanted to give it a chance again but I see that nothing has changed in that area. Sine Clojure 1.3, the clojure-contrib or what ever it is now makes only trouble. More over the tutorial above asks to clone clojure from github which already outdates this tutorial because in github the current version is 1.4, and lein generates project description for 1.2. Is there any chance it will be cleaned up? Maybe there should be ENV variable which defines base version of clojure to which lein, swank, ant, mvn, clojure, emacs, clojure-contrib would align? On Nov 21, 1:13 pm, Michael Jaaka michael.ja...@googlemail.com wrote: Hi! When running ant command in cygwin on content cloned fromhttp://github.com/clojure/clojure.git I get 2 errors: [java] Testing clojure.test-clojure.java.io [java] [java] ERROR in (test-streams-defaults) (FileOutputStream.java:-2) [java] expected: (= content (do (spit (.toURI f) content :encoding UTF-8) (slurp (.toURI f) :encoding UTF-8))) [java] actual: java.io.FileNotFoundException: C:\Documents%20and %20Settings\mjaaka\clojure.java.io5093958105426009259test-reader- writer (System nie może odnaleźć określonej ścieżki) [java] at java.io.FileOutputStream.open (FileOutputStream.java:-2) [java] java.io.FileOutputStream.init (FileOutputStream.java: 194) [java] clojure.java.io/fn (io.clj:224) [java] clojure.java.io$fn__7808$G__7784__7815.invoke (io.clj: 63) [java] clojure.java.io/fn (io.clj:236) [java] clojure.java.io$fn__7808$G__7784__7815.invoke (io.clj: 63) [java] clojure.java.io/fn (io.clj:243) [java] clojure.java.io$fn__7808$G__7784__7815.invoke (io.clj: 63) [java] clojure.java.io/fn (io.clj:160) [java] clojure.java.io$fn__7834$G__7788__7841.invoke (io.clj: 63) [java] clojure.java.io$writer.doInvoke (io.clj:113) [java] clojure.lang.RestFn.applyTo (RestFn.java:139) [java] clojure.core$apply.invoke (core.clj:602) [java] clojure.core$spit.doInvoke (core.clj:6041) [java] clojure.lang.RestFn.invoke (RestFn.java:464) [java] clojure.test_clojure.java.io$fn__7581$fn__7598.invoke (io.clj:42) [java] clojure.test_clojure.java.io/fn (io.clj:42) [java] clojure.test$test_var$fn__6484.invoke (test.clj:693) [java] clojure.test$test_var.invoke (test.clj:693) [java] clojure.test$test_all_vars$fn__6488$fn__6495.invoke (test.clj:709) [java] clojure.test$default_fixture.invoke (test.clj:663) [java] clojure.test$test_all_vars$fn__6488.invoke (test.clj: 709) [java] clojure.test$default_fixture.invoke (test.clj:663) [java] clojure.test$test_all_vars.invoke (test.clj:705) [java] clojure.test$test_ns.invoke (test.clj:728) [java] clojure.core$map$fn__3811.invoke (core.clj:2431) [java] clojure.lang.LazySeq.sval (LazySeq.java:42) [java] clojure.lang.LazySeq.seq (LazySeq.java:60) [java] clojure.lang.Cons.next (Cons.java:39) [java] clojure.lang.RT.boundedLength (RT.java:1607) [java] clojure.lang.RestFn.applyTo (RestFn.java:130) [java] clojure.core$apply.invoke (core.clj:602) [java] clojure.test$run_tests.doInvoke (test.clj:743) [java] clojure.lang.RestFn.applyTo (RestFn.java:137) [java] clojure.core$apply.invoke (core.clj:600) [java] clojure.test_clojure$eval20599.invoke (run_tests.clj: 59) [java] clojure.lang.Compiler.eval (Compiler.java:6498) [java] clojure.lang.Compiler.load (Compiler.java:6935) [java] clojure.lang.Compiler.loadFile (Compiler.java:6896) [java] clojure.main$load_script.invoke (main.clj:282) [java] clojure.main$script_opt.invoke (main.clj:342) [java] clojure.main$main.doInvoke (main.clj:426) [java] clojure.lang.RestFn.invoke (RestFn.java:408) [java] clojure.lang.Var.invoke (Var.java:401) [java] clojure.lang.AFn.applyToHelper (AFn.java:161) [java] clojure.lang.Var.applyTo (Var.java:518) [java] clojure.main.main (main.java:37) [java] [java] ERROR in (test-input-stream) (FileInputStream.java:-2) [java] Uncaught exception, not in assertion. [java] expected: nil [java] actual: java.io.FileNotFoundException: C:\Documents%20and %20Settings\mjaaka\test-input-stream7006412293390645280txt (System nie może
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
Have you looked at this, http://dev.clojure.org/display/doc/Getting+Started+with+Emacs ? David 2011/11/21 Michael Jaaka michael.ja...@googlemail.com Hmmm... When trying to do http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html especially Add the following: (defproject test-project 0.1.0 :description Test Project :dependencies [[org.clojure/clojure 1.3.0] [org.clojure/clojure-contrib 1.2.0]] :dev-dependencies [[swank-clojure 1.2.1]]) Save and exit the file. ~$ lein deps ~$ lein swank there is an exception about not finding print-doc Any help? Emacs/swank thing is a nightmare. I wanted to give it a chance again but I see that nothing has changed in that area. Sine Clojure 1.3, the clojure-contrib or what ever it is now makes only trouble. More over the tutorial above asks to clone clojure from github which already outdates this tutorial because in github the current version is 1.4, and lein generates project description for 1.2. Is there any chance it will be cleaned up? Maybe there should be ENV variable which defines base version of clojure to which lein, swank, ant, mvn, clojure, emacs, clojure-contrib would align? On Nov 21, 1:13 pm, Michael Jaaka michael.ja...@googlemail.com wrote: Hi! When running ant command in cygwin on content cloned fromhttp:// github.com/clojure/clojure.git I get 2 errors: [java] Testing clojure.test-clojure.java.io [java] [java] ERROR in (test-streams-defaults) (FileOutputStream.java:-2) [java] expected: (= content (do (spit (.toURI f) content :encoding UTF-8) (slurp (.toURI f) :encoding UTF-8))) [java] actual: java.io.FileNotFoundException: C:\Documents%20and %20Settings\mjaaka\clojure.java.io5093958105426009259test-reader- writer (System nie może odnaleźć określonej ścieżki) [java] at java.io.FileOutputStream.open (FileOutputStream.java:-2) [java] java.io.FileOutputStream.init (FileOutputStream.java: 194) [java] clojure.java.io/fn (io.clj:224) [java] clojure.java.io$fn__7808$G__7784__7815.invoke (io.clj: 63) [java] clojure.java.io/fn (io.clj:236) [java] clojure.java.io$fn__7808$G__7784__7815.invoke (io.clj: 63) [java] clojure.java.io/fn (io.clj:243) [java] clojure.java.io$fn__7808$G__7784__7815.invoke (io.clj: 63) [java] clojure.java.io/fn (io.clj:160) [java] clojure.java.io$fn__7834$G__7788__7841.invoke (io.clj: 63) [java] clojure.java.io$writer.doInvoke (io.clj:113) [java] clojure.lang.RestFn.applyTo (RestFn.java:139) [java] clojure.core$apply.invoke (core.clj:602) [java] clojure.core$spit.doInvoke (core.clj:6041) [java] clojure.lang.RestFn.invoke (RestFn.java:464) [java] clojure.test_clojure.java.io$fn__7581$fn__7598.invoke (io.clj:42) [java] clojure.test_clojure.java.io/fn (io.clj:42) [java] clojure.test$test_var$fn__6484.invoke (test.clj:693) [java] clojure.test$test_var.invoke (test.clj:693) [java] clojure.test$test_all_vars$fn__6488$fn__6495.invoke (test.clj:709) [java] clojure.test$default_fixture.invoke (test.clj:663) [java] clojure.test$test_all_vars$fn__6488.invoke (test.clj: 709) [java] clojure.test$default_fixture.invoke (test.clj:663) [java] clojure.test$test_all_vars.invoke (test.clj:705) [java] clojure.test$test_ns.invoke (test.clj:728) [java] clojure.core$map$fn__3811.invoke (core.clj:2431) [java] clojure.lang.LazySeq.sval (LazySeq.java:42) [java] clojure.lang.LazySeq.seq (LazySeq.java:60) [java] clojure.lang.Cons.next (Cons.java:39) [java] clojure.lang.RT.boundedLength (RT.java:1607) [java] clojure.lang.RestFn.applyTo (RestFn.java:130) [java] clojure.core$apply.invoke (core.clj:602) [java] clojure.test$run_tests.doInvoke (test.clj:743) [java] clojure.lang.RestFn.applyTo (RestFn.java:137) [java] clojure.core$apply.invoke (core.clj:600) [java] clojure.test_clojure$eval20599.invoke (run_tests.clj: 59) [java] clojure.lang.Compiler.eval (Compiler.java:6498) [java] clojure.lang.Compiler.load (Compiler.java:6935) [java] clojure.lang.Compiler.loadFile (Compiler.java:6896) [java] clojure.main$load_script.invoke (main.clj:282) [java] clojure.main$script_opt.invoke (main.clj:342) [java] clojure.main$main.doInvoke (main.clj:426) [java] clojure.lang.RestFn.invoke (RestFn.java:408) [java] clojure.lang.Var.invoke (Var.java:401) [java] clojure.lang.AFn.applyToHelper (AFn.java:161) [java] clojure.lang.Var.applyTo (Var.java:518) [java] clojure.main.main (main.java:37) [java] [java] ERROR in (test-input-stream)
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
My Emcas is GNU Emacs 23.3.1 (2011-08-14 on fiona) On Nov 21, 2:30 pm, Michael Jaaka michael.ja...@googlemail.com wrote: Well I thing that I don't have package.el Doing ;; add to ~/.emacs.d/init.el if you aren't already using Marmalade. (require 'package) (add-to-list 'package-archives '(marmalade . http://marmalade-repo.org/packages/;)) (package-initialize) Didn't change anything. When I opened test.clj and ran M-x eval-buffer I got that symbol's function definition is void: def So where to put package.el? On Nov 21, 2:18 pm, David Nolen dnolen.li...@gmail.com wrote: Have you looked at this,http://dev.clojure.org/display/doc/Getting+Started+with+Emacs? David 2011/11/21 Michael Jaaka michael.ja...@googlemail.com Hmmm... When trying to do http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html especially Add the following: (defproject test-project 0.1.0 :description Test Project :dependencies [[org.clojure/clojure 1.3.0] [org.clojure/clojure-contrib 1.2.0]] :dev-dependencies [[swank-clojure 1.2.1]]) Save and exit the file. ~$ lein deps ~$ lein swank there is an exception about not finding print-doc Any help? Emacs/swank thing is a nightmare. I wanted to give it a chance again but I see that nothing has changed in that area. Sine Clojure 1.3, the clojure-contrib or what ever it is now makes only trouble. More over the tutorial above asks to clone clojure from github which already outdates this tutorial because in github the current version is 1.4, and lein generates project description for 1.2. Is there any chance it will be cleaned up? Maybe there should be ENV variable which defines base version of clojure to which lein, swank, ant, mvn, clojure, emacs, clojure-contrib would align? On Nov 21, 1:13 pm, Michael Jaaka michael.ja...@googlemail.com wrote: Hi! When running ant command in cygwin on content cloned fromhttp:// github.com/clojure/clojure.git I get 2 errors: [java] Testing clojure.test-clojure.java.io [java] [java] ERROR in (test-streams-defaults) (FileOutputStream.java:-2) [java] expected: (= content (do (spit (.toURI f) content :encoding UTF-8) (slurp (.toURI f) :encoding UTF-8))) [java] actual: java.io.FileNotFoundException: C:\Documents%20and %20Settings\mjaaka\clojure.java.io5093958105426009259test-reader- writer (System nie może odnaleźć określonej ścieżki) [java] at java.io.FileOutputStream.open (FileOutputStream.java:-2) [java] java.io.FileOutputStream.init (FileOutputStream.java: 194) [java] clojure.java.io/fn (io.clj:224) [java] clojure.java.io$fn__7808$G__7784__7815.invoke (io.clj: 63) [java] clojure.java.io/fn (io.clj:236) [java] clojure.java.io$fn__7808$G__7784__7815.invoke (io.clj: 63) [java] clojure.java.io/fn (io.clj:243) [java] clojure.java.io$fn__7808$G__7784__7815.invoke (io.clj: 63) [java] clojure.java.io/fn (io.clj:160) [java] clojure.java.io$fn__7834$G__7788__7841.invoke (io.clj: 63) [java] clojure.java.io$writer.doInvoke (io.clj:113) [java] clojure.lang.RestFn.applyTo (RestFn.java:139) [java] clojure.core$apply.invoke (core.clj:602) [java] clojure.core$spit.doInvoke (core.clj:6041) [java] clojure.lang.RestFn.invoke (RestFn.java:464) [java] clojure.test_clojure.java.io$fn__7581$fn__7598.invoke (io.clj:42) [java] clojure.test_clojure.java.io/fn (io.clj:42) [java] clojure.test$test_var$fn__6484.invoke (test.clj:693) [java] clojure.test$test_var.invoke (test.clj:693) [java] clojure.test$test_all_vars$fn__6488$fn__6495.invoke (test.clj:709) [java] clojure.test$default_fixture.invoke (test.clj:663) [java] clojure.test$test_all_vars$fn__6488.invoke (test.clj: 709) [java] clojure.test$default_fixture.invoke (test.clj:663) [java] clojure.test$test_all_vars.invoke (test.clj:705) [java] clojure.test$test_ns.invoke (test.clj:728) [java] clojure.core$map$fn__3811.invoke (core.clj:2431) [java] clojure.lang.LazySeq.sval (LazySeq.java:42) [java] clojure.lang.LazySeq.seq (LazySeq.java:60) [java] clojure.lang.Cons.next (Cons.java:39) [java] clojure.lang.RT.boundedLength (RT.java:1607) [java] clojure.lang.RestFn.applyTo (RestFn.java:130) [java] clojure.core$apply.invoke (core.clj:602) [java] clojure.test$run_tests.doInvoke (test.clj:743) [java] clojure.lang.RestFn.applyTo (RestFn.java:137) [java] clojure.core$apply.invoke (core.clj:600) [java]
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
Manage to install package.el I have put (let ((buffer (url-retrieve-synchronously http://tromey.com/elpa/package-install.el;))) (save-excursion (set-buffer buffer) (goto-char (point-min)) (re-search-forward ^$ nil 'move) (eval-region (point) (point-max)) (kill-buffer (current-buffer into .emacs ran emacs removed from .emacs what have previously added ran from emacs: M-x package-refresh-contents then: M-x package-install enter clojure-mode got to warning on clojure-mode.el:69:1:Warning cl package required at runtime and clojure-mode:179:34:Warning : reference to free variable paraedit-mode doesn't know what it mean but also added (add-to-list 'load-path ~/.emacs.d/) (require 'clojure-mode) (require 'paredit) (defun turn-on-paredit () (paredit-mode 1)) (add-hook 'clojure-mode-hook 'turn-on-paredit) to init.el so final file is (require 'package) (add-to-list 'package-archives '(marmalade . http://marmalade-repo.org/packages/;)) (package-initialize) (add-to-list 'load-path ~/.emacs.d/) (require 'clojure-mode) (require 'paredit) (defun turn-on-paredit () (paredit-mode 1)) (add-hook 'clojure-mode-hook 'turn-on-paredit) now as tutorial on https://github.com/technomancy/clojure-mode states used: M-x run-lisp and got Searching for program: no such file or directory, lisp any help? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
I have ran: lein plugin install swank-clojure 1.3.3 from command line clojure-1.2.1 have been installed (why not 1.3.0???) and swank-clojure 1.3.3 later created test-project with: lein new test-project ran: emacs tmp/test-project/src/test_project/core.clj when used: M-x clojure-jack-in got: no match when used: M-x clojure- enter got list of available commands: clojure-enable-slime-on-existing-buffers clojure-load-file clojure-mode clojure-mode-font-lock-setup any thoughts? at least when opening clj file I have syntax highlighment, I wonder if paraedit is running and what it is. When I type [ a closing ] doesn't happen so I suppose that paraedit is turned off On Nov 21, 3:27 pm, Michael Jaaka michael.ja...@googlemail.com wrote: Manage to install package.el I have put (let ((buffer (url-retrieve-synchronously http://tromey.com/elpa/package-install.el;))) (save-excursion (set-buffer buffer) (goto-char (point-min)) (re-search-forward ^$ nil 'move) (eval-region (point) (point-max)) (kill-buffer (current-buffer into .emacs ran emacs removed from .emacs what have previously added ran from emacs: M-x package-refresh-contents then: M-x package-install enter clojure-mode got to warning on clojure-mode.el:69:1:Warning cl package required at runtime and clojure-mode:179:34:Warning : reference to free variable paraedit-mode doesn't know what it mean but also added (add-to-list 'load-path ~/.emacs.d/) (require 'clojure-mode) (require 'paredit) (defun turn-on-paredit () (paredit-mode 1)) (add-hook 'clojure-mode-hook 'turn-on-paredit) to init.el so final file is (require 'package) (add-to-list 'package-archives '(marmalade . http://marmalade-repo.org/packages/;)) (package-initialize) (add-to-list 'load-path ~/.emacs.d/) (require 'clojure-mode) (require 'paredit) (defun turn-on-paredit () (paredit-mode 1)) (add-hook 'clojure-mode-hook 'turn-on-paredit) now as tutorial onhttps://github.com/technomancy/clojure-modestates used: M-x run-lisp and got Searching for program: no such file or directory, lisp any help? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
On Monday, November 21, 2011 9:27:00 AM UTC-5, Michael Jaaka wrote: now as tutorial on https://github.com/technomancy/clojure-mode states used: M-x run-lisp and got Searching for program: no such file or directory, lisp any help? Try using the instructions from the next section of that page, entitled SLIME. $ lein plugin install swank-clojure 1.3.3 M-x clojure-jack-in # from inside a project Make sure you are in a project when you run clojure-jack-in. Initially, you can just do lein new dummy-project, then open the generated project.clj in emacs, change the clojure version to 1.3, and then run clojure-jack-in. That should get you a repl. Also you may need a lein deps in there somewhere. - Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
Already done, some report is a post above your reply. What does the from inside a project mean? Do I have to enter in bash to the dir root where is project.clj and run emacs? BTW. For all newbies the C-g is usefull. It aborts any command mode (like C-x C-f). On Nov 21, 3:38 pm, Chris Perkins chrisperkin...@gmail.com wrote: On Monday, November 21, 2011 9:27:00 AM UTC-5, Michael Jaaka wrote: now as tutorial onhttps://github.com/technomancy/clojure-modestates used: M-x run-lisp and got Searching for program: no such file or directory, lisp any help? Try using the instructions from the next section of that page, entitled SLIME. $ lein plugin install swank-clojure 1.3.3 M-x clojure-jack-in # from inside a project Make sure you are in a project when you run clojure-jack-in. Initially, you can just do lein new dummy-project, then open the generated project.clj in emacs, change the clojure version to 1.3, and then run clojure-jack-in. That should get you a repl. Also you may need a lein deps in there somewhere. - Chris -- 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
Proposal: libraries should have type hints
I want to propose that Clojure libraries should be fully type-hinted -- that is, they should be compiled with the *warn-on-reflection* option turned on and type hints place wherever possible. I understand the argument against type-hinting end-user code until a performance problem is demonstrated, and then only adding the hints where needed to fix the performance problems. Library writers, however, should add them wherever possible. The library writer has no way of knowing if his/her library will be used in a time-critical part of the application. If the application writer has to modify each library to add these type hints, long-term maintenance will be a nightmare. With each release of the library, the developer will have to re-check the performance and fix the library source code to add these hints. Am I way off base? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
In a project just means that the active buffer in emacs is a file under the project root. When you do clojure-jack-in, it will start from the current file's directory, and look up through parent directories until it finds a project.clj file. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
I'm far from being an expert on this stuff, but I did go through all the same frustration as you are going through, about 2 years ago, so I'll try to help. I think you have an old version of clojure-mode. The default archive that comes with package.el is at http://tromey.com/elpa. It contains an old clojure-mode. marmalade-repo contains the new version. Try doing M-x package-list-packages, and then search the list for clojure-mode - it should be version 1.11.4. Put the cursor beside that, press i (for install), then x (for execute). Then restart emacs. Let me know if that works. - Chris -- 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: Clojure on PyPy
I find this response the most interesting with respect to the OP's question. Can you elaborate how you re-define what clojure is? Then assuming we make no claim on ease of updating or strict adherence to what Clojure is defined to do, in other words we are making an evolution of ClojureScript, what would the PyPy implementation look like? How would things be simpler, and more complicated? What's the minimal set of functionality that needs to be implemented in RPython so that we can begin to define clojure.core. Rpython is very restrictive. Basically it's garbage collected C++ with a different syntax. So this means we can't import modules at runtime. So any additional libraries must be added via C FFI. So as an example, let's take a look at core/slurp. To properly implement this function, we need HTTP support...but where do we get this from? On the JVM and CLR this is simple. But in PyPy we need to go and find a HTTP library, find a way to link it in, figure out how to call it's methods via FFI, and then figure out how to dispose of any memory it creates. So what used to be a simple 5 lines of code calling HttpWebRequest (on the CLR), has now ballooned into a lib requirement, FFI, and a bunch of support routines. Or we can simply say slurp can only read from files, which means now you just create a doc of ways clojure-pypy differs from clojure-jvm. In some ways, this is why I'm in favor of going with a clojure-python translator. There would be a small impact in speed, but this means you could leverage the existing Python ecosystem. And to be honest, debugging Python is way better than RPython, for example: def foo (x, y): return x + y; x = 0 print foo(x, 1.0) print foo(x, 1) Will the above compile? In Python, yes, in RPython, noand here is the error you will receive: Resolution of foo has revolved to SomeObject. Previous definitions are foo(int, float), at foo(int int) Now if you work with RPython long enough...that may make sense...but most likely you won't quite understand that this is complaining because you've already created a function as having a float argument, and later you use it with a int argument. So to sum this up. With RPython you loose 100% of the ecosystem, and concurrency. With Python you still loose concurrency, but you have the ecosystem, but you do loose some performance. - Now let me say this: I'm in favor of Clojure on PyPy, it'd take a lot more work that it looks originally, but it's not impossible. I'm for this project, and I'd love to help. Sadly, I've got too many other things on my plate right now to head this up. But if someone else creates the project, and gets it going, I'll make regular commits and help where/whenever I can. Also, I'm only half joking about implementing a JVM on pypy...someone recently implemented the JVM on Javascript, so it's not that hard. Timothy -- 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: Proposal: libraries should have type hints
In principle you're right. But you have to keep in mind, that type hints actually alter runtime behavior. A hinted call tries to cast its argument into the desired type, possibly resulting in a type cast exception. An unhinted call, on the other hand, just looks for the signature. So in essence a hinted call can fail for cases where an unhinted call succeeds, effectively reducing composability at a type level (polymorphism). kind regards -- __ Herwig Hochleitner -- 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
ClojureScript new branches - feedback please
Note that none of the following branches are promises of features. I'm merely bringing them up to get feedback from ClojureScript users: prop-lookup New property syntax so that method calls and property lookup are no longer ambiguous 33-type-fn Nicer printing of types defined via deftype and defrecord - CLJS types now print properly at the REPL, can't do much for JS types since we can't enumerate them and we can't distinguish JS type ctors from actual JS fns. 96-ifn Can now define types that can be called as fns If you have some time please give these branches a spin and let us know what you think. https://github.com/clojure/clojurescript/branches 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: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
The only available clojure-mode is 1.7.1 The package is 0.9 The package.el I have installed from http://tromey.com/elpa/package- install.el I can see also slime in version 20100404, slime-repl in the same and swank-clojure in 1.1.0, the swank-clojure doesn't want to install because clojure-mode-1.7.1/clojure-mode.el already exists (I have then deleted elpa/clojure-mode-1.7.1 and installed again but after all in M-x package-list-packages there still no position like isntalled but available) On Nov 21, 4:03 pm, Chris Perkins chrisperkin...@gmail.com wrote: I'm far from being an expert on this stuff, but I did go through all the same frustration as you are going through, about 2 years ago, so I'll try to help. I think you have an old version of clojure-mode. The default archive that comes with package.el is athttp://tromey.com/elpa. It contains an old clojure-mode. marmalade-repo contains the new version. Try doing M-x package-list-packages, and then search the list for clojure-mode - it should be version 1.11.4. Put the cursor beside that, press i (for install), then x (for execute). Then restart emacs. Let me know if that works. - Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
The list of clojure- commands decreased to clojure-enable-slime-on- existing-buffers and clojure-mode On Nov 21, 4:03 pm, Chris Perkins chrisperkin...@gmail.com wrote: I'm far from being an expert on this stuff, but I did go through all the same frustration as you are going through, about 2 years ago, so I'll try to help. I think you have an old version of clojure-mode. The default archive that comes with package.el is athttp://tromey.com/elpa. It contains an old clojure-mode. marmalade-repo contains the new version. Try doing M-x package-list-packages, and then search the list for clojure-mode - it should be version 1.11.4. Put the cursor beside that, press i (for install), then x (for execute). Then restart emacs. Let me know if that works. - Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
I have added (add-to-list 'package-archives '(marmalade . http:// marmalade-repo.org/packages/)) to .emacs but getting Warning initialziation: An error occured while loading .emacs Symbols value as variable is void: package-archives On Nov 21, 4:03 pm, Chris Perkins chrisperkin...@gmail.com wrote: I'm far from being an expert on this stuff, but I did go through all the same frustration as you are going through, about 2 years ago, so I'll try to help. I think you have an old version of clojure-mode. The default archive that comes with package.el is athttp://tromey.com/elpa. It contains an old clojure-mode. marmalade-repo contains the new version. Try doing M-x package-list-packages, and then search the list for clojure-mode - it should be version 1.11.4. Put the cursor beside that, press i (for install), then x (for execute). Then restart emacs. Let me know if that works. - Chris -- 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: Proposal: libraries should have type hints
Herwig Hochleitner hhochleit...@gmail.com writes: Hi Herwig, In principle you're right. But you have to keep in mind, that type hints actually alter runtime behavior. A hinted call tries to cast its argument into the desired type, possibly resulting in a type cast exception. An unhinted call, on the other hand, just looks for the signature. So in essence a hinted call can fail for cases where an unhinted call succeeds, effectively reducing composability at a type level (polymorphism). Hm, indeed. This function works for any java object that has a zero-parameters doubleValue() method. (defn double-val [x] (.doubleValue x)) In contrast, (defn double-val [x] (.doubleValue ^Integer x)) will fail for (double-val 7), because by default any integer is a Long in Clojure 1.3. However, one could go with (defn double-val [x] (.doubleValue ^Number x)) instead, and that works fine for Integer, Long, Double, ... But of course, it's not applicable for class Foo { String doubleValue() {return foo;} } whereas the non-type-hinted version is. Note that this doubleValue() method doesn't even return a double. But is that really an issue? I mean, since you cannot use such duck typing in Java itself (except in terms of reflection), any method defined for more than one class with shared, consistent semantics is declared in some common parent class or interface which you can use for your type hint. Bye, Tassilo -- (What the world needs (I think) is not (a Lisp (with fewer parentheses)) but (an English (with more.))) Brian Hayes, http://tinyurl.com/3y9l2kf -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
Have tried to put in .emacs (when (load (expand-file-name ~/.emacs.d/elpa/package.el)) ) (setq package-archives '( (marmalade . http://marmalade-repo.org/packages/;) (gnu . http://elpa.gnu.org/ packages/))) (package-initialize) But didn't work. I have defined in package.el (defconst package-archive-base http:// tromey.com/elpa/) should i chanve that? I tried to replace it with http://marmalade- repo.org/packages/ but this resource doesn't have builtin-packages or somthing On Nov 21, 5:08 pm, Michael Jaaka michael.ja...@googlemail.com wrote: I have added (add-to-list 'package-archives '(marmalade . http:// marmalade-repo.org/packages/)) to .emacs but getting Warning initialziation: An error occured while loading .emacs Symbols value as variable is void: package-archives On Nov 21, 4:03 pm, Chris Perkins chrisperkin...@gmail.com wrote: I'm far from being an expert on this stuff, but I did go through all the same frustration as you are going through, about 2 years ago, so I'll try to help. I think you have an old version of clojure-mode. The default archive that comes with package.el is athttp://tromey.com/elpa. It contains an old clojure-mode. marmalade-repo contains the new version. Try doing M-x package-list-packages, and then search the list for clojure-mode - it should be version 1.11.4. Put the cursor beside that, press i (for install), then x (for execute). Then restart emacs. Let me know if that works. - Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
OK. I have replaced content of package.el with this recommended by http://marmalade-repo.org/ Added (add-to-list 'package-archives '(marmalade . http://marmalade- repo.org/packages/)) to .emacs installed clojure-mode, swank etc. Then I entered into Clojure project, used: M-x clojure-jack-in (almost there!!!) And got exception: Unable to resolve symbol print-doc. LOL :-) Any suggestions? On Nov 21, 5:16 pm, Michael Jaaka michael.ja...@googlemail.com wrote: Have tried to put in .emacs (when (load (expand-file-name ~/.emacs.d/elpa/package.el)) ) (setq package-archives '( (marmalade . http://marmalade-repo.org/packages/;) (gnu . http://elpa.gnu.org/ packages/))) (package-initialize) But didn't work. I have defined in package.el (defconst package-archive-base http:// tromey.com/elpa/) should i chanve that? I tried to replace it with http://marmalade- repo.org/packages/ but this resource doesn't have builtin-packages or somthing On Nov 21, 5:08 pm, Michael Jaaka michael.ja...@googlemail.com wrote: I have added (add-to-list 'package-archives '(marmalade . http:// marmalade-repo.org/packages/)) to .emacs but getting Warning initialziation: An error occured while loading .emacs Symbols value as variable is void: package-archives On Nov 21, 4:03 pm, Chris Perkins chrisperkin...@gmail.com wrote: I'm far from being an expert on this stuff, but I did go through all the same frustration as you are going through, about 2 years ago, so I'll try to help. I think you have an old version of clojure-mode. The default archive that comes with package.el is athttp://tromey.com/elpa. It contains an old clojure-mode. marmalade-repo contains the new version. Try doing M-x package-list-packages, and then search the list for clojure-mode - it should be version 1.11.4. Put the cursor beside that, press i (for install), then x (for execute). Then restart emacs. Let me know if that works. - Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
On Monday, November 21, 2011 11:27:04 AM UTC-5, Michael Jaaka wrote: Then I entered into Clojure project, used: M-x clojure-jack-in (almost there!!!) And got exception: Unable to resolve symbol print-doc. LOL :-) Any suggestions? Do you have the latest version of swank-clojure? Look in ~/.lein/plugins - it should be version 1.3.3 - Chris -- 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
A few questions on how to do things in more idiomatic ways
1. Often I use the following construct: (let [some-var (initial-binding) some-var (some operations (assoc, etc.) using some-var pvevious binding) some-var (some operations using some-var pvevious binding several times)] (more operations on some-var)) This is probably something like the `do' monad, and I like the thing that the usage of previous binding of the variable is possible freely anywhere in the context without wrapping operations with fn and calling threading operator. But things become bad if misspelling occurs. Are there some library macros for such operations, or possibility to do this in less error- prone way? 2. Let's assume that there is a map with key :entry, and I need to assoc new value for this key if it's nil or leave map as is otherwise. I do this in following way: ... (let [some-map (if (:entry some-map) some-map (assoc some-map :entry (get-new-value)))] ... The question is the same: what is the most correct way to do this? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
On Mon, Nov 21, 2011 at 7:03 AM, Chris Perkins chrisperkin...@gmail.com wrote: I think you have an old version of clojure-mode. The default archive that comes with package.el is at http://tromey.com/elpa. It contains an old clojure-mode. marmalade-repo contains the new version. This confusion has been a long-standing problem with Marmalade which I reported ages ago but hasn't been fixed. Please add comments on http://code.google.com/p/marmalade/issues/detail?id=20 encouraging the maintainer to apply the patch that provides correct instructions if this has bitten you. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: A few questions on how to do things in more idiomatic ways
off top of my head i would probably do something like: 1. (- some-var (assoc :foo bar) other-operation and-another) (see threading macros) 2. (update-in some-map [:entry] #(or % (get-new-value))) in particular, im not sure if there is a more idiomatic way On Mon, Nov 21, 2011 at 12:46 AM, gchristnsn gchrist...@gmail.com wrote: 1. Often I use the following construct: (let [some-var (initial-binding) some-var (some operations (assoc, etc.) using some-var pvevious binding) some-var (some operations using some-var pvevious binding several times)] (more operations on some-var)) This is probably something like the `do' monad, and I like the thing that the usage of previous binding of the variable is possible freely anywhere in the context without wrapping operations with fn and calling threading operator. But things become bad if misspelling occurs. Are there some library macros for such operations, or possibility to do this in less error- prone way? 2. Let's assume that there is a map with key :entry, and I need to assoc new value for this key if it's nil or leave map as is otherwise. I do this in following way: ... (let [some-map (if (:entry some-map) some-map (assoc some-map :entry (get-new-value)))] ... The question is the same: what is the most correct way to do this? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To 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: Proposal: libraries should have type hints
On Mon, Nov 21, 2011 at 8:12 AM, Tassilo Horn tass...@member.fsf.org wrote: But is that really an issue? I mean, since you cannot use such duck typing in Java itself (except in terms of reflection), any method defined for more than one class with shared, consistent semantics is declared in some common parent class or interface which you can use for your type hint. There are cases, in several contrib libraries, where a single function effectively wraps a set of overloaded Java methods. In order to add type hints in such situations, the code would have to expand to a series of conditionals that queried the type at runtime just so different branches could type hint the overloaded calls correctly (to remove the warnings). I don't think that's a good idea. In general tho', I think contrib libraries should be free of reflection warnings as much as possible (and I've opened issues against some contrib libraries that had a lot of such warnings - and they've mostly been fixed). -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure on PyPy
I was thinking about this too. I don't really need Clojure-on-pypy but I want to learn and understand the pypy project. I think that pypy is an extreamly cool project and I want to learn more about it and it would be fun to implment Clojure (and I would finally learn python). The problem Timothy mentions are very real but I (at least at first) dont really care about IO problems. Clojure is diffrent on every platform anyways, if Clojure-pypy would not support everything clojure does. I would go at it by first writting a interpreter for a language that supports everything clojure-script does. Then in a second step make the programm conformant with the RPython restrictions. In a third step then maybe creating the IO facilitis. I just don't like the workflow of compiling everything. If I want to use clojure on the comandline i want to write clojure-pypy mytool.cljp. Does this seam resenable? I was thinking about starting this rather soon. For me it would be a research type project (at least at first). Would anybody care to work with me on this? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure on PyPy
I just don't like the workflow of compiling everything. If I want to use clojure on the comandline i want to write clojure-pypy mytool.cljp. Does this seam resenable? I was thinking about starting this rather soon. For me it would be a research type project (at least at first). Would anybody care to work with me on this? I would love to help out on this project. A few things to think about: 1) PyPy takes a very, very loose view of bytecode. That is, there is no reason to execute bytecode inside your interpreter. Instead...in LISP data=code. So why not just allow any arbitrary object to be eval()? Basically this means you can write a pure LISP interpreter...and PyPy will write the JIT. 2) It should be possible to implement only a very, very small subset of Clojure in RPython, then write the rest in Clojure. ClojureScript does a very, very good job at this. The idea is that you define deftype, defprotocol, if, def, and a few other functions, then implement 100% of the rest of the code via these functions. Using arrays, it's possible to implement PersistentHashMaps, Vectors, etc. And then the nice thing is, you can completely modify the underlying interpreter at will, and not have to modify any code. I guess what I'm suggesting, is that you abstract Clojure from the VM that it operates on. As long as the compiler knows how to deftype, defprotocol, etc., it can run your Clojure subset. I guess the above two points are mostly to keep you from having to re-implement code in the future, or have to spend a ton of time on useless code. I've built a bytecode system in PyPy and it's no fun. As it is, you'll have fun with just basic things like figuring out how to add a float and a int. Timothy -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Proposal: libraries should have type hints
On Nov 21, 12:24 pm, Sean Corfield seancorfi...@gmail.com wrote: On Mon, Nov 21, 2011 at 8:12 AM, Tassilo Horn tass...@member.fsf.org wrote: But is that really an issue? I mean, since you cannot use such duck typing in Java itself (except in terms of reflection), any method defined for more than one class with shared, consistent semantics is declared in some common parent class or interface which you can use for your type hint. There are cases, in several contrib libraries, where a single function effectively wraps a set of overloaded Java methods. In order to add type hints in such situations, the code would have to expand to a series of conditionals that queried the type at runtime just so different branches could type hint the overloaded calls correctly (to remove the warnings). I don't think that's a good idea. This is way, way faster than using reflection. And all you need in order to remove the duplication is a macro that does the hinting for you: (defmacro multi-hinted-let [[name expr classes] body] (let [x (gensym)] `(let [~x ~expr] (condp instance? ~x ~@(for [class classes clause [class `(let [~(with-meta name {:tag class}) ~x] ~@body)]] clause) (throw (IllegalArgumentException. (str No matching class for ~x in '~classes))) (def l (ArrayList.)) user (.size l) Reflection warning, NO_SOURCE_FILE:1 - reference to field size can't be resolved. 0 user (multi-hinted-let [x l [LinkedList ArrayList]] (.size x)) 0 user (macroexpand-1 '(multi-hinted-let [x l [LinkedList ArrayList]] (.size x))) (let [G__2251 l] (condp instance? G__2251 LinkedList (let [^LinkedList x G__2251] (.size x)) ArrayList (let [^ArrayList x G__2251] (.size x)) (throw (IllegalArgumentException. (str No matching class for G__2251 in (quote [LinkedList ArrayList])) -- 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: Clojure on PyPy
On Monday, November 21, 2011 10:28:18 AM UTC-5, tbc++ wrote: Rpython is very restrictive. Basically it's garbage collected C++ with a different syntax. So this means we can't import modules at runtime. So any additional libraries must be added via C FFI. So as an example, let's take a look at core/slurp. To properly implement this function, we need HTTP support...but where do we get this from? On the JVM and CLR this is simple. But in PyPy we need to go and find a HTTP library, find a way to link it in, figure out how to call it's methods via FFI, and then figure out how to dispose of any memory it creates. So what used to be a simple 5 lines of code calling HttpWebRequest (on the CLR), has now ballooned into a lib requirement, FFI, and a bunch of support routines. Or we can simply say slurp can only read from files, which means now you just create a doc of ways clojure-pypy differs from clojure-jvm. I specified that we could be looser on what we define Clojure to meet. So I was hinting at implementing in a manner similar to ClojureScript, where we simply define the lisp primitives and deftype/defprotocol. We wouldn't have to implement slurp in rpython, we could instead implement it in clojure+. Also, I'm only half joking about implementing a JVM on pypy...someone recently implemented the JVM on Javascript, so it's not that hard. In my opinion, I think this is the most sane approach. This goes better with eval everything mentality of PyPy. You get another JVM implementation with fancy cool new optimizations. So not only do you get Clojure, you get Scala, Groovy, Java, etc. Now while this is probably a more daunting project, people have implemented JVM's in other languages, and this pulls from a larger pool of motivation, so more people would be likely to work on it. -- 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: clojure.java.io/reader vs clojure.stacktrace/print-cause-trace call
On Mon, Nov 21, 2011 at 3:17 AM, ru soro...@oogis.ru wrote: (clojure.stacktrace/print-cause-trace e) gives me an error message during compilation: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.stacktrace ! You need to require the clojure.stacktrace namespace before you can use it: user= (require 'clojure.stacktrace) nil user= (clojure.stacktrace/print-cause-trace (Exception. foo)) java.lang.Exception: foo at user$eval72.invoke (NO_SOURCE_FILE:3) clojure.lang.Compiler.eval (Compiler.java:6465) ... Some (commonly used) namespaces are loaded by default, other (less widely used) namespaces are not. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Proposal: libraries should have type hints
On Mon, Nov 21, 2011 at 12:50 PM, Alan Malloy a...@malloys.org wrote: This is way, way faster than using reflection. And all you need in order to remove the duplication is a macro that does the hinting for you: Well, if Clojure/core decide contrib libraries should indeed use conditional code to avoid reflection warnings, then a macro like this should be added somewhere standard so we don't all have to reinvent the wheel. The same logic applies to the when-available macro which tests features so code can be written to work with Clojure 1.2 and 1.3... -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure on PyPy
So I got thinking about clojure pypy tonight, and got thinking how easy it would be to adapt my old code to run as a interpreter. So I pulled in a few files, implemented a few methods, and I have prototype running (+ 1 2) as interpreted lisp code. I slapped it up on github...it's ugly, but it's a start: https://github.com/halgari/clj-pypy The idea here is simple. Every object in the VM must implement evaluate(self). Functions must then implement invoke(self, args). Most objects will simply return themselves when evaluate is called, there are some exceptions: Var objects return the result of evaluating their most recent binding Symbols find a var that corresponds to their name, and runs evaluate() on that Lists have the following code in evaluate(): def evaluate(self): f = self.first().evaluate() print f = , f args = [] h = self.rest() while h is not None: args.append(h.first().evaluate()) h = h.rest() return f.invoke(args) Basically lists evaluate all their arguments, then construct a arglist and pass the arguments to the first item in the list. The awesome thing about this is that this all would be quite expensive in most VMs, but the majority of this will be optimized away by the pypy JIT. I have to admit, I'm very excited about this project. PyPy's JIT goes bug nuts when it can work with immutable structures, I think we'll start to realize over time that the tracing JIT is a excellent fit for a LISP like language. And the fact that (at least in my vm) we don't have bytecode, this means that we can truly have code be the same as data. BTW...the code on github probably won't compile with PyPy yet. I just ran it in Python 2.7. I want to get the code in scratchspace.clj working first then I'll get it to run in RPython. Timothy -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure on PyPy
On 11/22/2011 02:10 PM, Timothy Baldridge wrote: So I got thinking about clojure pypy tonight, and got thinking how easy it would be to adapt my old code to run as a interpreter. So I pulled in a few files, implemented a few methods, and I have prototype running (+ 1 2) as interpreted lisp code. I slapped it up on github...it's ugly, but it's a start: https://github.com/halgari/clj-pypy Timothy, you may want to have a look at my Scheme in Python interpreter. There might be some overlaps. The difference is of course that Scheme requires the interpreter to by fully tail recursive so you'll see trampolining and continuations all over the code. One design decision I made was structuring the whole interpreter as a set of stream processing routines. That is the reader takes a stream of characters and produces a stream of tokens, which goes to the parser (1) producing a stream of s-expressions, which goes to evaluator... (1) here should come the macro expander but I haven't finished it yet. The code is on github: https://github.com/andrzej-r/PScheme Cheers, Andrzej -- 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: Explanation of with-resource
Brilliant, thanks Meikel! Quite a complex macro, that. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
Well, in plugins i had 1.3.3 but in project/dev had 1.2.1 and 1.3.3 so I deleted the 1.2.1. Then tried again to jack-in and got something like this: error in process filter: Opening input file: no such file or directory, /home/mjaaka/tmp/test-project/src/test_project/C:Documents and Settings^Gmjaaka/.emacs.d/swank/slime-cdf283b4.el So there is a problem with building absolute path on cygwin (by swank?). My .emacs.d is located at C:\cygwin\home\mjaaka\.emacs.d and there is no /swank/slime-cdf283b4.el The nearest silme.el is located at C:\cygwin\home\mjaaka\.emacs.d\elpa \slime-20100404.1\slime.el Beside this in elpa I have clojure-mode-1.11.4, clojure-project- mode-1.0, clojurescript-mode-0.5, levenshtein-1.0, project-mode-1.0. On Nov 21, 5:54 pm, Chris Perkins chrisperkin...@gmail.com wrote: On Monday, November 21, 2011 11:27:04 AM UTC-5, Michael Jaaka wrote: Then I entered into Clojure project, used: M-x clojure-jack-in (almost there!!!) And got exception: Unable to resolve symbol print-doc. LOL :-) Any suggestions? Do you have the latest version of swank-clojure? Look in ~/.lein/plugins - it should be version 1.3.3 - Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin
If you're having problems with cygwin, you could use Emacs/lein without it: http://sourceforge.net/apps/wordpress/codesounding/2011/09/29/installing-emacs-24-and-clojure-mode-on-windows-7-step-by-step/ On Tue, Nov 22, 2011 at 8:24 AM, Michael Jaaka michael.ja...@googlemail.com wrote: Well, in plugins i had 1.3.3 but in project/dev had 1.2.1 and 1.3.3 so I deleted the 1.2.1. Then tried again to jack-in and got something like this: error in process filter: Opening input file: no such file or directory, /home/mjaaka/tmp/test-project/src/test_project/C:Documents and Settings^Gmjaaka/.emacs.d/swank/slime-cdf283b4.el So there is a problem with building absolute path on cygwin (by swank?). My .emacs.d is located at C:\cygwin\home\mjaaka\.emacs.d and there is no /swank/slime-cdf283b4.el The nearest silme.el is located at C:\cygwin\home\mjaaka\.emacs.d\elpa \slime-20100404.1\slime.el Beside this in elpa I have clojure-mode-1.11.4, clojure-project- mode-1.0, clojurescript-mode-0.5, levenshtein-1.0, project-mode-1.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