[racket-dev] Are There More String Functions?

From: namekuseijin (namekuseijin at gmail.com)
Date: Wed Apr 18 17:03:11 EDT 2012

On Wed, Apr 18, 2012 at 4:12 PM, Eli Barzilay <eli at barzilay.org> wrote:
> * Finally, I'm also adding a related function:
>  `string-normalize-spaces', which takes a string and a regexp for the
>  spaces, and turns all spaces into single ones.  Same principles as
>  above.  This one is getting a `#:trim?' keyword that says whether
>  spaces at the edges should be dropped (the default) or normalized.
>
>  BTW, I hate that name -- it makes the `string-' prefix looks even
>  uglier...  Any suggestions for a better name?

compact-spaces?  Why should all functions have a type prefix?  How
many functions could be possibly named normalize-spaces not dealing
with strings?

why should it take a regexp for the spaces, BTW?

(compact-spaces "foobar was               here!")

should be self-evident without requiring the user to provide the
common-sense regex everytime...

the `#:trim keyword is a good idea...


Posted on the dev mailing list.