Re: clojure.string unexpected behaviors

2016-06-23 Thread Elena Machkasova
I wasn't saying that the functions implementation is incorrect (it does follow the specification). However, I think 'capitalize' obscures the error in the case when it would've been easy to fail early and produce meaningful error reporting (as 'reverse' does). Adding spec conditions would help,

Re: clojure.string unexpected behaviors

2016-06-21 Thread Sean Corfield
On 6/21/16, 1:28 PM, "Alex Miller" wrote: > I'm not a fan of the word "garbage" in this case or "garbage in / garbage > out". For me there’s no judgment involved in the “GIGO” principle but fair enough. > "specified"/"unspecified" is much better. It’s inaccurate. Unspecified behavior is where

Re: clojure.string unexpected behaviors

2016-06-21 Thread Alex Miller
On Tuesday, June 21, 2016 at 2:45:45 PM UTC-5, Sean Corfield wrote: > > Alex gave you a correct (but fairly short) answer. I’d like to expand on > it a bit, partly in light of a certain recent blog post, partly because of > a personal “hot button”… > > This is going to be along the same lines as

Re: clojure.string unexpected behaviors

2016-06-21 Thread Sean Corfield
Alex gave you a correct (but fairly short) answer. I’d like to expand on it a bit, partly in light of a certain recent blog post, partly because of a personal “hot button”… This is going to be along the same lines as clojure.set functions producing “garbage” output if you give them “garbage” in

Re: clojure.string unexpected behaviors

2016-06-21 Thread Alex Miller
There are some comments at the top of clojure.string (http://clojure.github.io/clojure/#clojure.string) about expected usage. In particular, you should expect all clojure.string functions to accept CharSequence (a parent interface of String, StringBuffer, and StringBuilder and return the same (

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

Re: clojure.string no namespace error

2011-10-18 Thread Omer Kudat
Thanks, I think I was trying to wrong thing (don't know why I was trying to use import rather than require). -- 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 member

Re: clojure.string no namespace error

2011-10-18 Thread Aaron Bedra
Here's an example from the REPL that should get you going: user => (require '[clojure.string :as str]) nil user=> (str/split-lines "foo\nbar\r\nbaz\n") ["foo" "bar" "baz"] Cheers, Aaron Bedra -- Clojure/core http://clojure.com On 10/18/2011 05:52 AM, Omer Kudat wrote: Hi all, I've started to

Re: clojure.string no namespace error

2011-10-18 Thread Philipp Meier
If you do a (require 'clojure.string) then all vars will be accessible as clojure.string/... e.g.clojure.string/split-lines . You can use "use" to import the vars into the current namespane: (use 'clojure.string) This wil make available all vars from clojure.string in you current namespace

Re: clojure.string/replace-first return nil when not matched

2011-03-20 Thread Takahiro Hozumi
Hi, Please bump up my JIRA membership level to make edits and I will fix this bug. I have an account named Takahiro Hozumi on dev.clojure.org already. CA is also already sent. Thanks. On 3月11日, 午後10:55, Stuart Sierra wrote: > > (require '[clojure.string :as str]) > > (str/replace-first "abc def"

Re: clojure.string/replace-first return nil when not matched

2011-03-11 Thread Stuart Sierra
> > (require '[clojure.string :as str]) > (str/replace-first "abc def" #"ghi" (fn [a] (str a a))) > => nil > That's a bug. Created http://dev.clojure.org/jira/browse/CLJ-753 Thanks for the report. -Stuart Sierra clojure.com -- You received this

Re: clojure.string/replace-first return nil when not matched

2011-03-10 Thread Armando Blancas
1. The Clojure wrapper put the last two calls inside the if, unlike Matcher#replaceFirst(), thus the nil. public String replaceFirst(String replacement) { if (replacement == null) throw new NullPointerException("replacement"); StringBuffer sb = new StringBuffer(); reset();

Re: clojure.string

2010-09-29 Thread Tim Olsen
On 09/24/2010 01:45 PM, Rasmus Svensson wrote: > 2010/9/24 cej38 : >> I noticed that clojure.string is not showing up on the API webpage, >> http://clojure.github.com/clojure/, is that an oversight? >> > > All the clojure.java.* namespaces and clojure.test are gone too... I > don't think this is i

Re: clojure.string

2010-09-24 Thread Rasmus Svensson
2010/9/24 cej38 : > I noticed that clojure.string is not showing up on the API webpage, > http://clojure.github.com/clojure/, is that an oversight? > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@go

Re: clojure.string namespace missing from API page?

2010-08-20 Thread Stuart Halloway
Those links are fixed, thanks. And we are aware that there are a ton of other links that still point to "richhickey" instead of "clojure", sprinkled throughout clojure.org. Anybody know how to do a bulk search/replace across wikispaces? There seems to be no facility... Stu > Hi guys. If you

Re: clojure.string namespace missing from API page?

2010-08-20 Thread Alf Kristian Støyle
Hi guys. If you google "Clojure API", the first hit gets you the following page: http://clojure.org/api Which again leads to: http://richhickey.github.com/clojure/ http://richhickey.github.com/clojure-contrib/ As I understand these pages are not the correct ones. I have finally bookmarked the co

Re: clojure.string namespace missing from API page?

2010-07-19 Thread Btsai
Thank you Tom :) On Jul 18, 12:10 pm, Tom Faulhaber wrote: > The official doc for clojure and clojure-contrib have moved as well. > They are now at: > > http://clojure.github.com/clojure/ > > and > > http://clojure.github.com/clojure-contrib/ > > I have not got them completely up-to-date with the

Re: clojure.string namespace missing from API page?

2010-07-18 Thread Tom Faulhaber
clojure.string is now in for the master branch doc at http://clojure.github.com/clojure/ Separate 1.2 doc coming RSN. Tom On Jul 18, 11:10 am, Tom Faulhaber wrote: > The official doc for clojure and clojure-contrib have moved as well. > They are now at: > > http://clojure.github.com/clojure/ >

Re: clojure.string namespace missing from API page?

2010-07-18 Thread Tom Faulhaber
The official doc for clojure and clojure-contrib have moved as well. They are now at: http://clojure.github.com/clojure/ and http://clojure.github.com/clojure-contrib/ I have not got them completely up-to-date with the 1.2 beta split, so for the moment just look at the master branch. I expect t

Re: clojure.string namespace missing from API page?

2010-07-17 Thread Adrian Cuthbertson
Yes, sorry, my post referred to the source, not the online doc API. Perhaps someone else can answer regarding that? On Sat, Jul 17, 2010 at 5:58 PM, Btsai wrote: > Thank you Adrian.  I did see in the release announcement thread that > that is the new source site for 1.2.  However, I was unable to

Re: clojure.string namespace missing from API page?

2010-07-17 Thread Btsai
Thank you Adrian. I did see in the release announcement thread that that is the new source site for 1.2. However, I was unable to find an online API there. http://richhickey.github.com/clojure/ is the only online API I have seen. And again, the other new 1.2 namespaces like clojure.java.io show

Re: clojure.string namespace missing from API page?

2010-07-17 Thread Adrian Cuthbertson
Hi Benny, The 1.2 release source site has moved to http://github.com/clojure/ -Regards, Adrian On Sat, Jul 17, 2010 at 8:00 AM, Btsai wrote: > Hi Clojurians, > > The recent 1.2 beta release is the first time I played with 1.2.  When > reading the release notes, I saw a number of new namespaces.