On May 27, 2010, at 2:45 AM, Stefan Kamphausen wrote:

> Hi,
> 
> On May 26, 11:00 pm, Stuart Halloway <stuart.hallo...@gmail.com>
> wrote:
>> The people have spoken! The trims have it!
> 
> sorry, I'm a little late.  However, to me it is not clear what the
> trim functions shall do.  If they become a replacement for chomp they
> are clearly misnamed.  In many applications and languages (like Excel,
> several SQL variants, oh, and Java, ...) "trim" means stripping of
> whitespace characters, including but not limited to \n and \r.  In
> contrast to that chomp stands for the removal of the system-specific
> linebreak.

I disagree that "trim" is a misnomer for this function. It may be used as 
shorthand for "trim whitespace" in some programming languages, but it's not 
universal even within CS, and it's not what "trim" by itself means in English. 
And Clojure has already shown that it is willing to break with established 
terminology in order to Get Things Right.

> Usually trim-functions accept an optional list of chars to trim.  So
> if a trim function would be implemented as a char-remover, defaulting
> to whitespace, and chomp would then be equivalent to (trim "foo\n" "\r
> \n") -- the second arg should probably something seqable -- everything
> seems fine to me.

I agree with the proposal for a second, optional argument to trim; I'm 
ambivalent about whether chomp would still be necessary then. I'd prefer the 
optional trim argument to be an actual set of characters (the semantics are 
more appropriate, and it might allow a more performant implementation), but I 
wouldn't object too hard if it accepted any seq of chars instead.

-- 
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

Reply via email to