Re: clojure.string/capitalize API

2012-12-14 Thread Pierre Allix
> I agree that with regards to 'least astonishment' the core fn should > capitalize all characters. This is what I'd expect from a fn called > 'capitalize'. > There is already an upper-case function, thus capitalize should either capitalize the first character or all characters who begin a se

Re: clojure.string/capitalize API

2012-12-12 Thread Marek Kubica
On Wed, 12 Dec 2012 09:44:28 -0600 Grant Rettke wrote: > Fro that principle, who is the least astonished who is it based on? I jsut wanted to say, people coming e.g. from Python. But then I realized it does the same thing and afterwards I was enlightened that it doesn't matter since I never use

Re: clojure.string/capitalize API

2012-12-12 Thread Jim foo.bar
There is an easy solution to your problem...Just hange the fn definition slightly. For example I am regularly using this: (defn un-capitalize [^String s] (let [Cfirst (subs s 0 1) Crest (subs s 1) ] (str (.toLowerCase Cfirst) Crest))) It is pretty obvious what you need to do to convert the abo

Re: clojure.string/capitalize API

2012-12-12 Thread Grant Rettke
On Wed, Dec 12, 2012 at 8:12 AM, Pierre Allix wrote: > I think it does not follow principle of least astonishment. I would have > expected to convert only the first character. Moreover converting the other > characters make the function almost useless, I for instance had this string > to capita

Re: clojure.string/capitalize API

2012-12-12 Thread Chris Ford
This seems like quite a specialised function to have in a core string library. To me, the only behaviour that would be generic enough to include in a core library would be to capitalise all the letters of the string. On 12 December 2012 17:12, Pierre Allix wrote: > Hello, > > The clojure.string

clojure.string/capitalize API

2012-12-12 Thread Pierre Allix
Hello, The clojure.string/capitalize function is defined as follow: Converts first character of the string to upper-case, all other characters to lower-case. I think it does not follow principle of least astonishment. I would have expected to convert only the first character. Moreover convert