Re: Importing and using Enum types

2011-02-23 Thread Kasim
Thanks. That did the trick. -- 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 thi

Re: ANN: Clojure Toolbox (Early Beta)

2011-02-23 Thread David Jacobs
Looks fantastic, this is exactly what I was thinking about when I said Clojure libraries need more discoverability. Excellent work. David On Wednesday, 23 February 2011 at 10:12 pm, semperos wrote: > Thanks for taking the time and effort to put this together. > > -Daniel > -- > You received

Re: ANN: Clojure Toolbox (Early Beta)

2011-02-23 Thread semperos
Thanks for taking the time and effort to put this together. -Daniel -- 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

Re: Release.Next Version Number

2011-02-23 Thread Ken Wesson
On Wed, Feb 23, 2011 at 9:23 PM, Brian Marick wrote: > > On Feb 23, 2011, at 3:06 PM, David Jacobs wrote: > >> Thanks for the suggestions. I should say that I was only giving you my >> impression of using Clojure re: it's version number. I'm not saying any of >> the things I listed are not doabl

Re: Release.Next Version Number

2011-02-23 Thread Brian Marick
On Feb 23, 2011, at 3:06 PM, David Jacobs wrote: > Thanks for the suggestions. I should say that I was only giving you my > impression of using Clojure re: it's version number. I'm not saying any of > the things I listed are not doable, just that they feel very ad-hoc and not > quite ready for

Re: Ordering of defn's?

2011-02-23 Thread Ken Wesson
On Wed, Feb 23, 2011 at 4:54 PM, Alessio Stalla wrote: > On 23 Feb, 19:51, Ken Wesson wrote: >> Java has a lack of this top-down processing, > > That's not true, what do you mean? > > class Foo { >  void bar() { baz(); } >  void baz() {} > } > > compiles fine, as well as > > class Foo { >  void b

Re: ignore-errors

2011-02-23 Thread Stuart Sierra
Clojure itself does not use exceptions for control flow. Java libraries sometimes do. -Stuart Sierra clojure.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

Re: Distributed atom :)

2011-02-23 Thread Stuart Sierra
Tim Dysinger did it with Hazelcast: https://github.com/dysinger/apparatus -Stuart Sierra clojure.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 mo

Re: Transforming map entries

2011-02-23 Thread Stuart Sierra
Reduce! (reduce (fn [new-map [key value]] (assoc new-map ...)) {} old-map) This is nice because you can change both keys and values, even add or remove keys. For something simpler: (into {} (fn [[key value]] ... ) old-map) -Stuart Sierra clojure.com -- You received this message because you

Re: Release.Next Version Number

2011-02-23 Thread David Jacobs
I don't really understand why snapshots should be in Clojars at all, yeah. It seems to me like CPAN, RubyGems, etc., encourage versioned software and not "snapshots", because they're going for non-volatile, stable packages. I think Clojars should, too. You're right, that's neither here nor there re

Re: Release.Next Version Number

2011-02-23 Thread Chas Emerick
On Feb 23, 2011, at 4:06 PM, David Jacobs wrote: > > - better discovery for existing, well-tested libraries. > > You can search on http://clojars.org/. This works well for me. > However, the key to well tested libraries is having people give > feedback if a library breaks or is badly documented

Re: ANN: Clojure Toolbox (Early Beta)

2011-02-23 Thread James Reeves
On 23 February 2011 23:37, Sam Aaron wrote: > How about a Music & Sound Synthesis section with a pointer to Overtone? Added. - James -- 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

Re: ANN: Clojure Toolbox (Early Beta)

2011-02-23 Thread Sam Aaron
James Reeves wrote: I'm sure I've covered only a very small proportion of Clojure libraries out there, so if you'd like to suggest a project that's not on there, please do so in this thread, or in an email to me. I'll try and update the site as quickly as possible. How about a Music & Sound

ANN: Clojure Toolbox (Early Beta)

2011-02-23 Thread James Reeves
I've put together a small, static site inspired by The Ruby Toolbox (ruby-toolbox.com), called (of course) The Clojure Toolbox. It's currently just a series of categorized links to Clojure projects, but I'll be gradually adding more functionality to it over the coming weeks. If you've been to the

Re: Release.Next Version Number

2011-02-23 Thread Glen Stampoultzis
>> - better discovery for existing, well-tested libraries. > > You can search on http://clojars.org/. This works well for me. > However, the key to well tested libraries is having people give > feedback if a library breaks or is badly documented or doesn't meet > their needs. I'm currently working

Re: Release.Next Version Number

2011-02-23 Thread Lee Spector
I don't have a strong opinion about the version number but I want to say that David's critiques of the state of the ecosystem all ring true to me. FWIW (and I offer this only because Saul is "genuinely interested in how they don't meet your needs" :-) here are my own responses to David's sugges

Re: Release.Next Version Number

2011-02-23 Thread Aaron Bedra
> > I come from the Ruby world, and Ruby isn't even a 2.0, so my perspective is > definitely colored. > It seems to me like (most) of the things you are talking about are not core language specific things. In particular for package management Ruby uses Rubygems which is a separate project, and ju

Re: Ordering of defn's?

2011-02-23 Thread Alessio Stalla
On 23 Feb, 19:51, Ken Wesson wrote: > Java has a lack of this top-down processing, That's not true, what do you mean? class Foo { void bar() { baz(); } void baz() {} } compiles fine, as well as class Foo { void bar() { new Baz(); } } class Baz {} > and it sometimes causes > problems be

Re: Ordering of defn's?

2011-02-23 Thread David Nolen
On Wed, Feb 23, 2011 at 3:12 PM, Jonathan Mitchem wrote: > I know it sounds like a finicky, minor issue, but it is actually that > important to me. It's not rejection to change, inasmuch as > unwillingness to intentionally make my life harder. > Consider how macros immediately affect the compila

Re: Release.Next Version Number

2011-02-23 Thread David Jacobs
Hi Saul, Thanks for the suggestions. I should say that I was only giving you my impression of using Clojure re: it's version number. I'm not saying any of the things I listed are not doable, just that they feel very ad-hoc and not quite ready for a "2.0". I come from the Ruby world, and Ruby isn'

Re: java.lang.Exception: transaction rolled back: java.lang.InterruptedException

2011-02-23 Thread Saul Hazledine
On Feb 23, 9:54 pm, clj123 wrote: > I'm getting the following exception trying to insert large batch data > in the database. I'd try to write less data at one time to the database. Start with, say, 20 rows at a time. Saul -- You received this message because you are subscribed to the Google Gr

Re: transaction rolled back: java.lang.InterruptedException

2011-02-23 Thread Saul Hazledine
On Feb 23, 9:42 pm, clj123 wrote: > I have been getting this exception: > java.lang.Exception: transaction rolled back: > java.lang.InterruptedException >         at clojure.contrib.sql.internal$throw_rollback.invoke(internal.clj: > 142) I can only take some wild guesses I'm afraid. The rollback

java.lang.Exception: transaction rolled back: java.lang.InterruptedException

2011-02-23 Thread clj123
I'm getting the following exception trying to insert large batch data in the database. Any ideas? java.lang.Exception: transaction rolled back: java.lang.InterruptedException at clojure.contrib.sql.internal$throw_rollback.invoke(internal.clj: 142) at clojure.contrib.sql.internal$tr

transaction rolled back: java.lang.InterruptedException

2011-02-23 Thread clj123
I have been getting this exception: java.lang.Exception: transaction rolled back: java.lang.InterruptedException at clojure.contrib.sql.internal$throw_rollback.invoke(internal.clj: 142) at clojure.contrib.sql.internal$transaction_STAR_.invoke(internal.clj: 169) at com.protot

transaction rolled back: java.lang.InterruptedException

2011-02-23 Thread clj123
I have been getting this exception: java.lang.Exception: transaction rolled back: java.lang.InterruptedException at clojure.contrib.sql.internal$throw_rollback.invoke(internal.clj: 142) at clojure.contrib.sql.internal$transaction_STAR_.invoke(internal.clj: 169) at com.protot

Re: Clojure namespace conventions

2011-02-23 Thread Mark Rathwell
This discussion has been had multiple times on this list, not sure how much new information you will get. See the following for a couple examples: http://groups.google.com/group/clojure/browse_thread/thread/968e9066223c3a2b/fbce84869dbf4ce6?lnk=gst# http://groups.google.com/group/clojure/browse_t

Clojure namespace conventions

2011-02-23 Thread Paul Richards
Hi, Is there a guide to the conventions for naming and structuring namespaces in a Clojure project? I see for example that the ".core" namespace is fairly common in different projects. Is this also where the "-main" entry point should live? Also is it typical to have code living in "someproject"

Re: Ordering of defn's?

2011-02-23 Thread Ken Wesson
On Wed, Feb 23, 2011 at 3:12 PM, Jonathan Mitchem wrote: >> Java has a lack of this top-down processing, and it sometimes causes >> problems because the order in which static initializers will execute >> is not generally predictable. > > If you're programming with a side-effect free functional app

Re: Ordering of defn's?

2011-02-23 Thread Jonathan Mitchem
> Java has a lack of this top-down processing, and it sometimes causes > problems because the order in which static initializers will execute > is not generally predictable. If you're programming with a side-effect free functional approach, that shouldn't be a problem right? Or are you saying tha

Re: Release.Next Version Number

2011-02-23 Thread Saul Hazledine
Below are suggestions to the shortcomings you mention. I'm genuinely interested in how they don't meet your needs. On Feb 23, 8:42 pm, David Jacobs wrote: > - definitive, simple, integrated package management Leiningen and Cake? > - a better REPL experience out of the box (esp. Jline support) Sl

Re: Release.Next Version Number

2011-02-23 Thread David Jacobs
If we want to practice semantic versioning[0] and the next iteration is introducing backwards-incompatible changes, we should go with 2.0. However, I have my reservations. Clojure itself feels solid to code with, but the *ecosystem* doesn't feel very 2.0. For that it would need: - definitive, simp

Re: Ordering of defn's?

2011-02-23 Thread rob levy
A related problem occurs when you separate your code into multiple namespaces. You can't create cyclic links with use or require. There's a case to be made for avoiding that situation, but the solution clojure provides when you need it is to import the vars using ns-resolve as in (def myfn (ns-r

RE: Release.Next Version Number

2011-02-23 Thread Lärry
Gang - I'm still in the "playing" stage with the language. I'm exploring Clojure and prototyping ideas for future directions. The language is very expressive and its community is quite supportive. One thing the environment lacks is a good, current book for beginners. Oh, there are a couple of

Re: Ordering of defn's?

2011-02-23 Thread Ken Wesson
Java has a lack of this top-down processing, and it sometimes causes problems because the order in which static initializers will execute is not generally predictable. I don't have any problems with Clojure files being processed from the top down. I prefer to define my terms (simpler functions) be

Re: Ordering of defn's?

2011-02-23 Thread Jonathan Mitchem
With C# inside of Visual Studio, I have very good IDE support for top- down design. If I use an undeclared method, it is displayed in red, with a tooltip saying "Cannot resolve symbol '[symbol name]'". A context menu provides me "generate > method stub", which will do what it says, and add parame

Re: Ordering of defn's?

2011-02-23 Thread Alessio Stalla
On 23 Feb, 01:28, Mark Engelberg wrote: > I'm not crazy about this behavior either, but my understanding is that > this is an intentional design decision that is a direct consequence of > two things: > 1.  In Clojure IDEs, people want to be able to feed the compiler > single functions and expressi

Re: Ordering of defn's?

2011-02-23 Thread Brian Marick
On Feb 22, 2011, at 6:28 PM, Jonathan Mitchem wrote: > It just seems to interrupt my flow when coding. Maybe that's not a > legitimate enough concern, but coming from first principles, that > seems to be one of the fundamental gains of Clojure. This annoys me as well. I made an Emacs macro tha

Re: Transforming map entries

2011-02-23 Thread Benny Tsai
That is true. Thank you for the reminder. On Feb 23, 10:18 am, Laurent PETIT wrote: > 2011/2/23 Benny Tsai > > > My guess is that Clojure's fmap behaves that way because it is modeled > > Note that it's not "Clojure's fmap". > fmap is a function in a clojure contrib namespace. > > The distincti

Re: Transforming map entries

2011-02-23 Thread Chris Maier
On Wed, Feb 23, 2011 at 11:55 AM, Benny Tsai wrote: > My guess is that Clojure's fmap behaves that way because it is modeled > after Haskell's fmap Hmm, I thought it might be a Haskell thing. > To pass both keys and values to your transforming function, I think > Alan's idea of using 'walk' is t

Re: Transforming map entries

2011-02-23 Thread Laurent PETIT
2011/2/23 Benny Tsai > My guess is that Clojure's fmap behaves that way because it is modeled > Note that it's not "Clojure's fmap". fmap is a function in a clojure contrib namespace. The distinction may be important. -- You received this message because you are subscribed to the Google Group

ANN: Bandalore, a Clojure client library for Amazon’s Simple Queue Service (SQS)

2011-02-23 Thread Chas Emerick
"I recently found myself wanting to work with Amazon’s Simple Queue Service (SQS), but I could find no reasonable Clojure library for accessing it. Of course, AWS’ own Java SDK is the canonical implementation of their APIs (at least in the JVM space), so putting together a Clojure wrapper that

Re: Importing and using Enum types

2011-02-23 Thread Baishampayan Ghose
> The name of the Enum Class is (Unfortunately) IContainer.Type that lives in > com.xuggle.xuggler package. > I believe it is the dot within the IContainer.Type class name that is giving > me headache. > > I'd appreciate any input or work around that I am not aware of. Try IContainer$Type/READ and

Re: Transforming map entries

2011-02-23 Thread Benny Tsai
My guess is that Clojure's fmap behaves that way because it is modeled after Haskell's fmap, which only accepts functions that operate only on the values due to the way fmap (and the Functor typeclass that fmap belongs to) is modeled in Haskell's type system. To pass both keys and values to your t

Re: Importing and using Enum types

2011-02-23 Thread Kasim
Thanks Ken. I was able to use enums before as you have suggested but here is the specific issue: The name of the Enum Class is (Unfortunately) IContainer.Type that lives in com.xuggle.xuggler package. I believe it is the dot within the IContainer.Type class name that is giving me headache. I'd

Re: Transforming map entries

2011-02-23 Thread Meikel Brandmeyer
And at the underkill end of the spectrum :) (comp #(.toUpperCase %) mymap) (Seriously: might be feasible of you don't need the map properties afterwards...) Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, sen

Re: Transforming map entries

2011-02-23 Thread Stanislav Paskalev
Perhaps this is an overkill, but it comes to my mind :) (I'm new to clojure) user=> (def mymap {:a (ref "foo") :b (ref "bar")}) #'user/mymap user=> mymap {:a #, :b #} user=> (map #(dosync (ref-set %1 (repeat 2 (deref %1 (vals mymap)) (("foo" "foo") ("bar" "bar")) user=> mymap {:a #, :b #} St

Re: Transforming map entries

2011-02-23 Thread Chris Maier
Can anybody explain why fmap, when operating on an IPersistentMap, only passes the function the value of the map entry, instead of the entire map entry (i.e., the key and value pair)? It seems a bit odd in that all the other implementations of fmap operate on the entire item in the sequence. Also

Re: Ordering of defn's?

2011-02-23 Thread Laurent PETIT
There has been some debate about this over time in the clojure mailing list. I too regret from time to time the ability to organize my code "top-down" without having to resort to "tricks" (declare). I had suggested that unknown vars encountered during compilation could just be "automatically decla

Re: Implementing search algorithm for binary tree

2011-02-23 Thread Alex Osborne
HB writes: > I'm trying to implement searching algorithm for binary tree. > > (defrecord Node [data left-child right-child]) > > (defrecord Tree [root]) > > (defn find-node [tree data] > "Search for a node" > (let [root (:root tree)] > (loop [current root] > (if (= data (:data curre

Re: Java Agent Based Modeling Systems and Clojure

2011-02-23 Thread bOR_
I've been programming agent-based models in clojure for the last 2 years, and I've found that having a vector full of refs works fine. If two individuals interact (in my case, form a relationship), I use dosync and alter in a parallel environment to ensure that noone is starting more relationsh

Re: akka

2011-02-23 Thread Saul Hazledine
On Feb 23, 1:17 am, Mark Engelberg wrote: > 3. What is Clojure's state-of-the-art for building distributed, > fault-tolerant systems with its existing feature set and/or leveraging > popular libraries? > I've not used it, but jobim is worth looking at since it brings together all the components r

Re: Transforming map entries

2011-02-23 Thread Joost
On Feb 22, 4:08 am, yair wrote: > I'm hoping this is a dumb question and I've missed something obvious. > I have a map with various key-value pairs and I want to transform some > of the values, e.g. > > (def mymap {:first "john" :last "smith" :age 25}) and say I want to > change the strings to be