Re: jdbc and postgresql type problem
On Jul 11, 6:41 am, Aaron Bedra wrote: > Silly question, but which version of java.jdbc are you using? Up until > 0.0.3 I had no end of troubles with psql because of the batchExecute issue. I tested Wilfred's code with 0.0.3-SNAPSHOT. --Brian -- 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: jdbc and postgresql type problem
On Jul 10, 4:52 pm, Wilfred wrote: > I'm at a bit of a loss. "UPDATE comments SET approved='1' WHERE id = > '1'" works fine in psql. approved is a boolean field, so is this an > issue with the SQL library producing incorrect SQL? I think this is an oddity with the JDBC driver for PostgreSQL. The driver doesn't seem to like doing automatic typecasting. Try this: (sql/update-values :comments ["id = cast(? as integer)" id] ;; alternatively "id = ?::integer" {:approved true}) Or you could (Integer/parseInt id) to do the cast before you pass it as parameter, though in either case you should validate your id before casting, if you want to avoid dying on poorly-formed input. --Brian -- 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.contrib.sql => clojure.java.jdbc - looking for feedback!
On Apr 26, 10:13 am, Sean Corfield wrote: > On Tue, Apr 26, 2011 at 6:19 AM, David Powell wrote: > > There is justification for resultset-seq's current behaviour, even if it > > isn't to everyone's preference. > > Agreed. And I would actually want the lowercasing behavior to remain > the default, for my own use anyway. What irks me more is the lack of > translation between foo_bar and :foo-bar or, for folks who camelCase > column names, between fooBar and :foo-bar perhaps. This all goes back > to the idea of a "naming strategy" for translating between Clojure > keywords and SQL entity names. > > I think at this point it makes sense to add a function to c.j.j that > mimics the current resultset-seq functionality but allows for the > application of naming strategies - with the default being the current > behavior, and some other standard strategies available. > > The question then is whether the c.j.j function should also be called > resultset-seq or whether a new name should be picked? > > However, c.j.j functions yield the _result_ of resultset-seq so > perhaps it doesn't even need to expose the function itself? On the > other hand, if c.j.j supports naming strategies to provide different > keyword/entity translations, users may want to be able to apply the > same translations to any raw resultSet objects they have... Thoughts? > I'd like to at least have the option of passing SQL query strings verbatim to the SQL server and getting returned data verbatim as well, with no auto-quoting or column name munging at all (including downcasing). Name-munging can be implemented on top of functions that return data and column names verbatim, but the opposite is not true. --Brian -- 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-contrib 1.3.0-alpha1
On Sep 24, 1:34 pm, Stuart Sierra wrote: > OK, individual modules appear to work now on 1.3.0-alpha1 Yep, it works now. Many thanks for fixing this so quickly. I feel your pain. --Brian -- 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-contrib 1.3.0-alpha1
On Sep 24, 8:09 am, Stuart Sierra wrote: > I have deployed release 1.3.0-alpha1 of clojure-contrib. > > This is the first public release of the modularized clojure-contrib. > > If you just want one big JAR file, download it > fromhttp://github.com/clojure/clojure-contrib/downloads > > If you want JARs for individual modules, look > athttp://build.clojure.org/releases/org/clojure/contrib/ > > That list of modules is copied below. If you want to depend on a > particular module in your Leiningen / Maven / Ivy project, use the > following coordinates: > > Group ID: org.clojure.contrib > Artifact ID: (the module name) > Version: 1.3.0-alpha1 > > For example, to depend on clojure.contrib.datalog in a Leiningen > project, your project.clj will look like this: > > (defproject foo "1.0.0" > :dependencies > [[org.clojure.contrib/datalog "1.3.0-alpha1"] > ...]) > > If you just want to depend on all of clojure-contrib, you *should* be > able to do it by depending on the "complete" module. Right now, this > doesn't seem to work in Leiningen unless you add :classifier "bin" to > the dependency. I think this is because Leiningen doesn't fully > understand "pom"-style dependencies, but I'm not entirely sure. As of yesterday, the "complete" dependency still doesn't work with Maven unless you add bin. [1] [2] As of today, I can't even manage to pull individual libs. I thought this was how to fetch clojure.contrib.sql, but it fails. [3] I'd appreciate some help if I'm doing something incorrectly. --Brian [1] http://groups.google.com/group/clojure/msg/b95bb37a64158e03 [2] http://gist.github.com/594252 [3] http://gist.github.com/595895 -- 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-contrib master now in submodules
On Sep 22, 2:03 pm, Stuart Sierra wrote: > On Sep 22, 12:35 pm, Justin Kramer wrote: > > > Here's the magic incantation I've been using: > > > [org.clojure.contrib/complete "1.3.1-SNAPSHOT" :classifier "bin"] > > > I don't know how official or future-proof that is. > > It's wrong, technically, but appears to work for now. > > I think this may be a problem with Leiningen not understanding "pom" > packages. If somebody can confirm that, we can try to fix it. > > -S No, plain Maven has the same problem. If I add bin to this pom it works, without it fails: http://gist.github.com/594252 --Brian -- 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-contrib master now in submodules
On Sep 9, 3:13 pm, Stuart Sierra wrote: > Can you clarify? Maven-aware build tools (e.g. Leiningen) should not > be trying to downlaod the "clojure-contrib:complete" JAR file. > Instead, referencing the "complete" project as a dependency should > transitively give you all its dependencies. Does that not work? > > -S Nope. When I use [org.clojure.contrib/complete "1.3.0-SNAPSHOT"] without :classifier "bin", Maven dies because it can't find the "complete" JAR file. Like this: http://gist.github.com/572306 When I specify [... :classifier "bin"], it downloads all 50+ contrib JAR files, as well as "complete-1.3.0-SNAPSHOT-bin.jar". --Brian -- 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-contrib master now in submodules
On Aug 20, 7:22 am, Stuart Sierra wrote: > If you want to use ALL contrib libraries, add a dependency on group > "org.clojure.contrib", artifact "complete", version "1.3.0-SNAPSHOT". > This meta-library depends on all other contrib libraries. This doesn't work because as was pointed out on IRC today, there's currently a "bin" classifier. You have to use: [org.clojure.contrib/complete "1.3.0-SNAPSHOT" :classifier "bin"] --Brian -- 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: Leiningen 1.2.0 released
On Aug 21, 1:04 am, "evins.mi...@gmail.com" wrote: > Up til now, I've avoided using ELPA (it doesn't play nicely with my 25 > years' worth of Lisp-oriented emacs customizations). It may be helpful > for other hoary old lisp hackers to know that you really want to use > ELPA with lein, no matter how fervently you may believe that you > don't. I managed to evade ELPA up until this lein release, but it > seems the free ride is over. It's possible to use SLIME+Clojure without ELPA and without clobbering your other Lisps. Check out http://github.com/vu3rdd/swank-clojure-extra for starters. Personally I still forgo `lein swank` in favor of setting things up for `M-x slime` myself. The best bits of lein (dependency management, jar-file making etc.) work great without Emacs getting involved. I am convinced that ELPA is probably the best option for a Clojure/ Emacs newbie to get set up easily, but it's not for me and there are plenty of other people who share your aversion. Many thanks Phil and Leiningen contributors for another release. --Brian -- 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 Web Programming group?
On Aug 17, 7:15 am, Saul Hazledine wrote: > One idea I had though was to go one step further and start a Clojure > web development group so that other developers of small libraries and > users of them could go to one place for support and discussion. Would > this be uncool or would it be useful? > > Saul I think it would be useful. I don't think it would replace each project's individual list for things like bug reports and feature requests. But it would be nice to have a place for end-users of the various libraries to talk about using them, and talk about integrating them. --Brian -- 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: Game development in Clojure
On Aug 13, 11:09 am, Wilson MacGyver wrote: > I assumed he didn't use OpenGL because it's a 2d tile game? > Using OpenGL for 2d or 2.5d (isometric) is really only a good idea > if you can assume the target has hardware OpenGL acceleration. > > Even then you may not want to do that, due to battery concerns. > But there are some good OpenGL 2D game engines for Java, e.g. Slick[1]. There's also Penumbra[2] which nicely wraps LWJGL for Clojure. I ask this mostly because I'm making my own 2D game and somewhat torn between Java2D and OpenGL. Penumbra is pretty solid in my experience. What do you mean by "battery concerns"? --Brian [1] http://slick.cokeandcode.com/ [2] http://github.com/ztellman/penumbra -- 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: Game development in Clojure
On Aug 13, 6:51 am, Mike Anderson wrote: > Hello all, > > I've recently been working on a game development project in Clojure > which is now starting to bear fruit. I thought people here might be > interested, and that it would be worthwhile to share some experiences > and perspectives. > Looks great. Thanks for sharing your experiences. Do you plan to share the source code? Any reason you went with Swing instead of OpenGL? --Brian -- 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: Leiningen 1.2.0 released!
On Jul 18, 5:17 pm, defn wrote: > I think I speak for everyone when I say: "thank you". inc --Brian -- 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: Deview - Better test results
On Jul 14, 5:03 pm, Brenton wrote: > I'm not sure what's going on with that error. As you can see from [1], > testing-vars-str takes no args. Also, I don't get an error message > when running as a Leiningen plugin or from the REPL. Let me know if > you think of anything else that might be causing this problem. I > hacked this together today so I am sure there is something I'm > missing. I'm looking here: http://github.com/clojure/clojure/blob/master/src/clj/clojure/test.clj#L288 Looks like that function's signature changed a couple weeks ago: http://github.com/clojure/clojure/commit/a9d9ddb6ad4f86809d44f8e3370ae284f0a084f2 --Brian -- 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: Deview - Better test results
On Jul 14, 1:05 pm, Brenton wrote: > > I have created a new project named lein-difftest. > > http://github.com/brentonashworth/lein-difftest > This is awesome. I've been hurting for this kind of tool for a long time. For peons like myself who still run tests from a REPL and want to see plaintext diffed output, apparently you can use this library and do (difftest.core/run-tests 'some-ns) instead of (clojure.test/run-test 'some-ns) and it seems to work well. Minor bug, on line 36 in difftest/core.clj [1], (ct/testing-vars-str) should probably be (ct/testing-vars-str m), I'm getting an exception otherwise: java.lang.IllegalArgumentException: Wrong number of args (0) passed to: test$testing-vars-str Thanks --Brian [1] http://github.com/brentonashworth/lein-difftest/blob/master/src/difftest/core.clj#L36 -- 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
defmulti - defonce semantics?
I just noticed this in the 1.2 beta release notes: * defmulti - Enhanced to have defonce semantics I've been bitten by this for a couple months now and I never knew the reason. If (during interactive development) you want to change the dispatch function for a multimethod, what is now the proper way? I used to be able to just rerun the defmulti or recompile/reload the file containing the defmulti. I'd lose all the methods defined for that multimethod (which sometimes forced me to hunt down all the files that defined methods on it and recompile them all too), but I could live with that. Clojure 1.1.0 user=> (defmulti foo (fn [x] x)) #'user/foo user=> (defmulti foo (fn [x y] x)) #'user/foo user=> (defmethod foo :foo [x y] y) # user=> (foo :foo :bar) :bar But now: Clojure 1.2.0-beta1 user=> (defmulti foo (fn [x] x)) #'user/foo user=> (defmulti foo (fn [x y] x)) ;;does nothing nil user=> (defmethod foo :foo [x y] y) # user=> (foo :foo :bar) java.lang.IllegalArgumentException: Wrong number of args (2) passed to: user$eval1$fn (NO_SOURCE_FILE:0) I've been putting (def foo nil) (defmulti foo ...) in a bunch of my source files to force recompilation whenever the files are recompiled. Thanks --Brian -- 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: Hash-map destructuring
On Jun 25, 2:57 am, Chas Emerick wrote: > This is fairly simple: > > user=> (defn foo [& {:as args}] [args]) > #'user/foo > user=> (def m {:a 5 :b 6}) > #'user/m > user=> (apply foo (-> m seq flatten)) > [{:a 5, :b 6}] > > I'm not sure if it could be made easier, short of changing apply > (which I wouldn't think is reasonable). > > - Chas That was what I tried first, but it doesn't work. It flattens too much. Note that I have a vector as one of the map values in my example. --Brian -- 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: State of Clojure web development
On Jun 23, 2:23 pm, James Reeves wrote: > 1. Have you written, or are you writing, a web application that uses > Clojure? What does it do? My blog and a couple of other blog-like hobby sites. I also wrote a small standalone data-collection app at work. It collects survey data for psych research. > 2. Which libraries or frameworks are you using? Which versions? [[org.clojure/clojure "1.2.0-master-SNAPSHOT"] [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"] [compojure "0.4.0-RC3"] [hiccup "0.2.4"] [clout "0.2.0"] [ring/ring-jetty-adapter "0.2.0"] [ring/ring-devel "0.2.0"] [oyako "0.1.1"] [postgres-pool "1.1.0"] [joda-time "1.6"] [rhino/js "1.7R2"] [sandbar/sandbar "0.2.3"]] I try to stick with bleeding-edge versions of almost everything. You almost have to, things change too quickly. > 3. What made you choose Clojure to develop web applications in? What > are the strengths of Clojure web development? DSL-based HTML generation (as per Hiccup) is a huge selling point for me. Nothing else compares. Lispy interactive development via REPL is great for webapps. Web development is a good place to take advantage of macros and other boilerplate-elimination techniques that a Lisp gives you. I mostly chose Clojure for web development mostly because I like Clojure and wanted an excuse to use it more. > 4. What do you think are the current weaknesses of web development in > Clojure? What could be improved? Deployment is my main headache. Better documentation / more examples for Compojure and other libs would be very useful. DB interaction / data persistence is a bit of a weakness, but the Clojure world is improving very quickly in this area. > 5. Anything else you want to comment on? Web development in Clojure is loads of fun. Thanks for your work on Ring/Compojure/etc., they're great tools. --Brian -- 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: Leiningen documentation review?
On Jun 16, 9:24 pm, Phil Hagelberg wrote: > Mostly I'd like feedback on the > tutorial:http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md It looks quite good. Maybe some mention of `lein clean` is warranted. It would preclude a lot of the "Hey I just upgraded library X and now everything is broken" kinds of questions I see on various mailing lists. The part discussing the group-id/artifact-id etc. is great for those of us who don't know maven. Can you consider adding something about how to name a project in project.clj so that it can be pushed to clojars cleanly? On clojars you see projects named with a bare word, like "compojure" and "swank-clojure", and then others with a one-word group-id, "foo/bar", then others with a full domain, "org.clojars.someguy/baz". This is a bit of a mess. But I wonder how many packages are pushed to clojars under the wrong name or wrong group-id accidentally, not realizing how it would end up looking. It might be helpful to promote a convention for project naming, if nothing else. Or if there's already some convention that I'm missing, maybe explain the convention. Just a thought. --Brian -- 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
Hash-map destructuring
Given: (defn foo [x & {:as args}] [x args]) (foo 1 :bar 2 :baz [:quux]) => [1 {:bar 2, :baz [:quux]}] If I have those rest-arguments already in a map, what's the most elegant way to call foo with them? (def args {:bar 2 :baz [:quux]}) (foo 1 ?) I feel like I may be missing some simple way of doing it. I find myself needing to do this pretty often, for example any time I have a chain of functions calling each other that all take keyword arguments on the end. (apply foo 1 (apply concat (seq args))) works, but that's awfully nasty. So this is what I've been doing: (defmacro apply* [& args] `(apply ~@(butlast args) (apply concat (seq ~(last args) (apply* foo 1 args) => [1 {:bar 2, :baz [:quux]}] Kind of hacky though. Is there a better/shorter/builtin way? I can go back to using [x & args] in the function signature and (apply hash-map args) in the function body, but I love having the keyword destructuring in the function signature, since the user can see which keys are valid to pass in, whenever I use {:keys [...]}. Thanks --Brian -- 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: promoting contrib.string to clojure, feedback requested
On May 26, 10:29 am, Fogus wrote: > I have mentioned my gripes in the IRC, but for public view I would > love better names for chomp and chop. In isolation those names are > meaningless, so I suggest: Almost every name in a programming language is meaningless in isolation. But we don't work in isolation. Look at "slurp". I had to explain that one to a non-programmer colleague the other day. "chomp" has a clear meaning to anyone who's touched Perl/Ruby/shell- scripting. "rtrim" in isolation could mean trim newlines, or trim whitespace, or trim some specified characters, or trim arbitrary characters. "less" is so generic it could mean almost anything. But this is largely an aesthetic question and I'm not going to lose sleep if we end up with a word other than "chomp". --Brian -- 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: promoting contrib.string to clojure, feedback requested
On May 26, 8:16 am, Stuart Halloway wrote: > If you are a user of clojure.contrib.string, please take a look at the > proposed promotion to clojure [1]. Feedback welcome! It is my hope > that this promotion has enough "batteries included" that many libs can > end their dependency on contrib for string functions. Great to see these bumped into core. But are we now going to have clojure.string, and clojure.contrib.string, with half the string functions in one and half in the other? It's going to be confusing to remember which namespace has which functions (since I often use functions you aren't promoting here), and now I potentially have to depend on two libs instead of just one. split-lines (for example) is something I use constantly. It's also something just annoying/error-prone enough that I don't want to write (split #"\r?\n" s) over and over. I always trip over core's line-seq because it takes a reader instead of a string as I'd expect. It'd be nice to see that one promoted, if split is being promoted too. What's the point of promoting upper-case and lower-case? I thought Clojure generally avoided thin wrappers around Java methods. I always use the Java methods directly, personally. The comments say it's for mapping over a list of strings, but (map #(.toUpperCase %) xs) isn't that much typing. The only use I see for making these a Clojure function is to improve error-handling. (upper-case nil) gives an unhelpful NPE. --Brian -- 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: Choosing a Clojure build tool
On Mar 25, 3:42 pm, Chas Emerick wrote: > I'm not entirely sure what would be required from clojure-maven-plugin > (for example) for maven to achieve greater acceptance in the > community... I think all it takes is getting the word out. Ease of use matters to me, but sexp vs. XML or simple interface vs. complex is only one part of ease of use. Another part is community support and availability of documentation. It's easy to learn any tool when lots of people are using it and writing about it. Your article was enough to convince me and apparently a few others to give Maven a chance. If a section appeared on clojure.org called "Installing clojure and clojure-contrib via Maven" with a sample POM and simple instructions for starting a REPL, that'd probably help. Is build.clojure.org linked to from anywhere on clojure.org? I only know about it from your blog post and from having read through IRC logs, and it's mentioned in the clojure-contrib README but there's no example of how to use it. Your article is the first I've seen Clojure installed directly via Maven. --Brian -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: Choosing a Clojure build tool
On Mar 25, 11:55 am, Chas Emerick wrote: > I published a blog post earlier today, along with a short screencast > that might be of interest: > > "Like any group of super-smart programmers using a relatively new > language, a lot of folks in the Clojure community have looked at > existing build tools (the JVM space is the relevant one here, meaning > primarily Maven and Ant, although someone will bark if I don't mention > Gradle, too), and felt a rush of disdain. I'd speculate that this came > mostly because of XML allergies, but perhaps also in part because when > one has a hammer as glorious as Clojure, it's hard to not want to use > it to beat away at every problem in sight." Ruby: gem install X Perl: perl -MCPAN -e shell, then "install X" Why does building and installing dependencies have to be harder than this? Lein right now tries to fill this niche of being braindead easy to use, and comes pretty close. I realize Maven does a lot more than build and install dependencies, but for some of us, that's all we want out of life, and it's pretty nice when it's that easy to do so. My dream tool would be: 1) Platform-agnostic (for us sorry souls stuck on Windows at work) 2) IDE-agnostic ("make a Netbeans project" is great, but Emacs users need some love too) 3) Easy to understand and use for the kinds of tasks Lein covers (I don't want to have to study a Maven book(!) if I can avoid it) 4) Able to handle most or all Clojure and Java libraries I want to install (I don't want to have to circumvent the build tool and do things manually if I can help it) 5) Able to easily "browse" or search for packages in remote repositories, would be nice Rubygems and Perl's CPAN can handle those kinds of things, for example. If Maven can be those things, I'll have an XML sandwich for lunch with a smile if necessary. : ) Maybe it can and the community just needs to standardize around Maven and provide good documentation and community support for using it with Clojure. I just hope the community standardizes around something; any standard is better than everyone using a different tool. Thanks --Brian -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
clojure.contrib.error-kit bug?
(defn- special-form [form] (and (list form) (symbol? (first form)) (#{#'handle #'bind-continue} (resolve (first form) I think the second line should say (list? form). (list form) is always true. --Brian -- 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: Funding Clojure 2010
I sent my contribution. Thanks for your work on Clojure. It's brought me many weekends of joyful hacking. Please continue to let the community know what's necessary to sustain Clojure's development. On Dec 14, 6:33 am, Rich Hickey wrote: > Funding Clojure 2010 > > Background > -- > > It is important when using open source software that you consider who > is paying for it, because someone is. There is no such thing as free > software. > > Sometimes open source software is developed under a license with > undesirable properties (e.g. the GPL), such that people are willing to > pay for a (proprietary) version of it that is not subject to that > license. Both Monty Widenius [1] and Richard Stallman [2] have argued > for the necessity of such a mechanism to fund open source software, > lest there be insufficient resources for its development. Clojure > doesn't use the GPL, thus conveying more freedom to its users, but > precluding me from funding it via dual licensing. > > Some companies develop technology as a component of a proprietary > product or service, absorbing it as a necessary expense, only to > decide that it is not a core, unique, or advantage-bearing business > function. They can reduce their costs in ongoing development by open > sourcing it, deriving benefit from community contributions and letting > them focus on their core business [3]. It is important to note that > the bulk of the costs are often in the original development, and are > paid for by the proprietary product or service. That is not the case > for Clojure. > > Some open source is the product of academic research, and is funded by > the academic institution and/or research grants [4]. That is not the > case for Clojure. > > Some open source software is (partially) funded by proprietary > support. It is important to note that often the support income does > not in fact make it to the people who create the software. Such income > models work best for support sold to conservative enterprises [5]. > That is not the case for Clojure. > > Some companies 'fund' open source software by dedicating some of their > employees' time, or making investments, in its development. There must > be some business value to the company for doing so (e.g. it helps them > sell hardware [6]), and thus is ultimately paid for by their > proprietary products/services. That is not the case for Clojure. > > There *are* companies that make software themselves, whose consumers > see a value in it and willingly pay to obtain that value. The money > produced by this process pays the salaries of the people who are > dedicated to making it, and some profit besides. It's called > "proprietary software". People pay for proprietary software because > they have to, but otherwise the scenario is very similar to open > source - people make software, consumers get value from it. In fact, > we often get a lot less with proprietary software - vendor lock-in, no > source etc. Most alarmingly, this is the only model that associates > value with software itself, and therefore with the people who make it. > > Why don't people pay for open source software? Primarily, because they > don't *have to*. I think also, partially, it is because open source > software often doesn't have a price tag. I think it should. I'd like > to pay for open source, and know the money is going to those who > create it. I'd like companies to *expect* to pay for it. I'd like to > see people make a living (and even profit!) directly making open > source, not as a side effect of some other proprietary process, to > dedicate themselves to it, and not have it be hobby/side work. > > Unfortunately, there seems to be no way to convey the full benefits of > open source software while *forcing* people to pay for it. Only in the > proprietary (including dual-license) model is there a direct > connection between the consumers of software and the funding of those > that produce it. This is having the effect of driving open source > software towards having zero apparent cost, becoming a free bounty of > someone else's other profitable endeavors, and is severely > compromising our profession. > > Foreground > -- > > As should be obvious, Clojure is a labor of love on my part. Started > as a self-funded sabbatical project, Clojure has come to occupy me far > more than full-time. However, Clojure does not have institutional or > corporate sponsorship, and was not, and is not, the by-product of > another profitable endeavor. I have borne the costs of developing > Clojure myself, but 2009 is the last year I, or my family, can bear > that. > > Many generous people have made donations (thanks all!), but many more > have not, and, unfortunately, donations are not adding up to enough > money to pay the bills. So far, less than 1% of the time I've spent on > Clojure has been compensated. > > Right now, it is economically irrational for me to work on Clojure, > yet, I want to continue working on Clojure, and
Re: Uninterning a function
On Oct 21, 11:48 am, Gorsal wrote: > I'm trying to unintern a function i accidently defined in a namespace > which collides with another function i'm importing . i can't seem to > find an unintern, or undef, or anything to do this? How do i achieve > this? > > Thanks~~ I think this is what you want: (ns-unmap *ns* 'foo) --~--~-~--~~~---~--~~ 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: New string utilities library ready
On Aug 19, 2:16 pm, Sean Devlin wrote: > First, I would change the names of functions functions that collide > with core to str-take, str-drop, etc. It's just as much to type, and > it is safe to use these names. Also, it would make it easier for Rich > to promote the library to the standard lib when it's done. +1 I also think contains? might not be a good name given that it doesn't do the same thing as clojure.core/contains?. Aside from one being constant time and one being linear time, you have: user> (clojure.core/contains? "foobar" "f") false user> (clojure.contrib.str-utils2/contains? "foobar" "f") true I think this is potentially confusing. This also may be another point in favor of making the name str-contains?. An str- prefix would also be consistent with the re-* group of functions that deal with regexes. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Literal hash-maps with duplicate keys?
Can anyone explain this? user> (def x {:foo :bar :foo :baz :foo :quux}) #'user/x user> x {:foo :bar, :foo :baz, :foo :quux} user> (count (keys x)) 3 user> (map x (keys x)) (:bar :bar :bar) It's understandable that a literal map which includes the same key twice with different values could return any one of the given values. But I would expect the resulting map to have one key and one of the values. Note: user> (assoc {} :foo :bar :foo :baz :foo :quux) {:foo :quux} user> (conj {} [:foo :bar] [:foo :baz] [:foo :quux]) {:foo :quux} user> (hash-map :foo :bar :foo :baz :foo :quux) {:foo :quux} --~--~-~--~~~---~--~~ 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: Best practices for Slime with Clojure
On May 16, 12:58 am, Glen Stampoultzis wrote: > The other problem I have is with the current working directory. The swank > process seems to use my home directory as the current working > directory regardless of what the current working directory of emacs > currently is. Is there any way to set this and to manage it on a per > project basis? I agree, this is a big annoyance. You can put something like this in your ~/.emacs to prevent Emacs from changing your working directory every time you switch buffers, so once you set it with M-x cd, it'll never change until you change it explicitly. Better than nothing. (defun find-file-save-directory () (interactive) (setq saved-default-directory default-directory) (ido-find-file) (setq default-directory saved-default-directory)) (global-set-key "\C-x\C-f" 'find-file-save-directory) Change ido-find-file to whatever command you use normally to open files. --~--~-~--~~~---~--~~ 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 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: Keeping a ref and a DB in sync
On Apr 3, 12:42 pm, "rzeze...@gmail.com" wrote: > Brian, I imagine you are asking this in relation to your blog engine? Yep. Thanks everyone for the help and ideas. Unfortunately I do have a ton of data in a DB already so Terracotta would be a lot of work. I rewrote everything to do ref updates inside agents, and it worked (almost), but when I fired up 1000 concurrent threads to do simultaneous updates and set a certain percentage of them to throw an exception mid-transaction, I still ended up with the DB and the in- memory copy out of sync. Cleaning up when something failed was a nightmare to try to coordinate. I ended up storing all of my data in a single ref that holds the state of the universe and running a background thread in an agent that grabs a snapshot of the ref and syncs it with the DB every so often. I guess it's probably a little more Clojure-ish that way anyways, since the DB will always see a consistent snapshot. If this doesn't work I'll have to try watches I guess. --~--~-~--~~~---~--~~ 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 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 -~--~~~~--~~--~--~---
Keeping a ref and a DB in sync
Is there a safe way to keep the data in a Clojure ref and the data in a table in an external (e.g. mysql) database in sync, given concurrent creates/updates/deletes from within Clojure? I can't do a DB update from within a dosync because of retries. If I send-off an agent for the DB update from within a dosync, it won't happen until after the dosync is done, and then if the DB update throws an exception, it'll be too late to rollback the ref and they'll be out of sync. If I do the DB update and ref update separately, there's the potential for race conditions if things happen in between. Is manual locking the only way? --~--~-~--~~~---~--~~ 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 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: New release 20090320
On Mar 20, 7:15 am, Rich Hickey wrote: > New release 20090320 -http://clojure.googlecode.com/files/clojure_20090320.zip > > Incorporates all the recent additions - fully lazy seqs, :let option > for doseq/for, letfn for mutually recursive local fns, synchronous > watches, multi-arg set/union/difference/intersection, counted?, per- > defmulti hierarchies, #_ ignore form reader macro, future-calls, > future and pcalls/pvalues, defmulti docstrings and metadata, methods/ > prefers for multimethod reflection, uniform metadata handling for > atoms/refs/agents/vars/namespaces, condp, release-pending-sends, AOT > tweaks to support applets and Android, etc. All this in addition to > many fixes and enhancements. > > The API docs page is now current - changes to the rest of the site > will come soon. > > This release includes many patches from contributors, and input and > reports from many users - thanks all! > > Rich Congrats and many thanks to everyone who has worked so hard to make Clojure so powerful and fun to use. --~--~-~--~~~---~--~~ 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 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: On the importance of recognizing and using maps
On Mar 8, 10:53 am, Rich Hickey wrote:> > In looking at some of the libraries, I am a bit concerned that maps > are not being used when the logical entity is in fact a map. One time I find myself abusing vectors where maps would be better is in a situation where I have to retrieve key/value pairs in the order they were inserted. For example I'm working on a DSL for cascading stylesheets, and maps should be perfect for specifying property declarations (right down to curly braces for maps coincidentally and nicely matching the curly braces in literal CSS). But (css [:div {:padding "1px" :padding-left "5px"}]) won't work because the order is lost. Depending on the order "padding" and "padding-left" show up in the final CSS, the meaning changes. Not sure what the best Clojure idiom would be in this case. Vectors that look like maps are the best I've come up with. So "ordered maps" would be useful. They have been endlessly re- invented in the Ruby community, for example. I think in upcoming Ruby 1.9, maps that preserve their insertion order are the default, in spite of obviously worse performance compared to true hashed maps. --~--~-~--~~~---~--~~ 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 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 -~--~~~~--~~--~--~---
Importing lots of Java classes at once
One could argue that wildcard imports in Java (import package.*) are evil, pollute your namespaces, create potential naming conflicts, etc. One would probably be correct. One could also argue that having to manually type a list of dozens of classnames is pretty tedious, especially if all you want to do is goof off at a REPL for a few minutes. e.g. I wanted to run some SWT snippets [1], and to import all the necessary SWT classes into Clojure can be a bit of a pain. I found this somewhat appalling bit of code [2] which I can use to get a list of all the classnames in some package and then import them all that way. There are all kinds of ways that code can fail though. Does anyone else have a way that they routinely import lots and lots of Java classes at once? I don't care how dirty a hack it is, I'm not going to do this in production code. I only want to save my fingers a bit of typing. I know this probably isn't planned [3] for Clojure, just looking for the best workaround. [1]: http://www.eclipse.org/swt/snippets/ [2]: http://forums.sun.com/thread.jspa?threadID=341935&start=30&tstart=0 [3]: http://groups.google.com/group/clojure/browse_thread/thread/c65e19d51a5b794c/732925c7936abf83 --~--~-~--~~~---~--~~ 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 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: Unexpected binding behavior
On Jan 20, 10:06 am, "Hugh Winkler" wrote: > Inside FP, outside FP, all I want is no surprises. I agree, this is confusing for new users. Especially given the counter-intuitive (for a new person) way the REPL forces evaluation of everything, making everything seem to be eager when it's not. This aspect of Clojure is very different from most languages, including other Lisps, and the kinds of errors it can produce are often silent and hard to figure out. Some documentation loudly proclaiming the laziness of map and friends, the importance of dorun/doall/doseq, and the potential pitfalls of laziness would be helpful. Perhaps as an FAQ entry if nothing else? --~--~-~--~~~---~--~~ 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 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: QT Jambi and the Repl
On Jan 16, 5:38 pm, levand wrote: > Has anyone here had success in using Clojure with QT Jambi? > > I'm currently experimenting with porting my app from Swing to QT, and > although Jambi might well be the theoretically superior framework, it > seems like Swing is a lot easier to use with Clojure. > > The issue I'm currently running into is that you can't call any > methods on QT gui objects unless you're in the same thread they were > created in. But that can't be the Repl thread, because > QApplication.exec() basically sets up an event loop and takes control > of whatever thread you start it in. > > So, it looks like I can't do any of that cool interactive gui > development that I fell in love with in Rich's presentations, and have > continued to love using myself. > > Am I missing something? I thought I'd give QT a try, since everyone > seems to rave about it, but so far, in most ways, Swing seems easier > to use and more powerful. But maybe I'm just not familiar enough with > Jambi. > > Many thanks, > -Luke I have had some success writing a little app[1] in Qt Jambi in Clojure, for what it's worth. You can use QCoreApplication/ invokeLater or invokeAndWait to mess with Qt objects from different threads. I have managed to segfault the JVM while poking a running Qt Jambi app from a REPL. I also had some problems with memory leaks [2] for a time. It's not as stable and solid as Swing. It works though, and Qt is a nice framework to work with. [1]: http://github.com/briancarper/bcc-clojure/tree/master [2]: Most likely this issue: http://www.mail-archive.com/qt-jambi-inter...@trolltech.com/msg00592.html --~--~-~--~~~---~--~~ 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 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: Not understanding the proper use of map
On Dec 10, 12:07 pm, "Michael Wood" <[EMAIL PROTECTED]> wrote: > OK, I think I know why this happens. It's treating the '+ as the key > for a map, and using the second integer as the default value. I'm not > sure why it treats an integer as a map, though: > Wow, that's a bit of a gotcha. It's not treating the integer as a map though, get's default behavior is to return nil if the thing it's get- ing from isn't some kind of collection. (Which is also a bit of a gotcha, I think.) user> ('a (fn [])) nil user> ('a (Object.)) nil --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: POLL: Domain name for project hosting site.
On Nov 17, 11:52 am, Drew Crampsie <[EMAIL PROTECTED]> wrote: > Here are some suggestions so far, but please feel free to chime in > with your own as well. What about something made of whole words, like clojureforge? It has the benefit of discoverability and being pronounceable by the human tongue. : ) Any URL that requires a person to spell it every time it's said aloud is a bad thing, in my opinion. Projecture is best on the list given. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Standard Error to the REPL under Slime?
On Nov 13, 5:07 pm, Allen Rohner <[EMAIL PROTECTED]> wrote: > On Nov 7, 3:00 am, [EMAIL PROTECTED] wrote: > > > Hey folks, > > > Is there a way to get the System.err directed to the slime-repl > > clojure buffer instead of (or in addition to) inferior-lisp buffer? I > > looked through the docs, but I didn't see anything obvious. > > > Thanks! > > --Darren > > I'd also like to be able to do this. The recent swank-clojure history > doesn't show anything promising though. > > Allen M-x slime-redirect-inferior-output works for me. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Swing GUI Builder and Clojure
On Nov 4, 9:06 am, "Geoffrey Teale" <[EMAIL PROTECTED]> wrote: > If you teach the general principles of Clojure then using any of them should > be easy enough. As Graham said, it's better to stick with the out of the > box GUI layer for a general purpose book. Qt Jambi was actually a little > tricky to set up on my (rather esoteric!) Linux box, and you don't want > readers to get pissed off and give up! I blogged a little about Qt Jambi + Clojure recently [1], for what it's worth. I found it very easy to set up and use, on Gentoo Linux and on Vista. I'm using it to build an app in my spare time and it's working well. I would be interested to see anyone write up a HOWTO for using a GUI builder tool with Clojure, for Swing or Qt or any other framework. It is a bit tedious to do by hand. I agree though, for a book it might be better to stick with native Java stuff. No sense needlessly complicating matters with external libraries. Qt Jambi had a couple of odd quirks that I was unable to figure out. (Randomly killing my Clojure process under SLIME for example.) [1] http://briancarper.net/2008/10/31/qt4-in-lisp/ --Brian --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---