<br><br><div class="gmail_quote">On Thu, Apr 19, 2012 at 14:53, Matthew Flatt <span dir="ltr"><<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">At Thu, 19 Apr 2012 14:43:44 +0200, Laurent wrote:<br>
> On Thu, Apr 19, 2012 at 14:33, Matthew Flatt <<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>> wrote:<br>
><br>
> > I agree with this: we should add `string-split', the one-argument case<br>
> > should be as Eli wrote,<br>
><br>
><br>
> About this I'm not sure, as one cannot reproduce this behavior by providing<br>
> an argument (or it could make the difference between string-as-not-regexps<br>
> and regexps? Wouldn't this be different from other places?).<br>
<br>
</div>I'm suggesting that supplying `#f' as the argument would be the same as<br>
not supplying the argument.<br>
<br>
It is a special case, though. I don't mind the specialness here,<br>
because I see the job of `string-split' as making a couple of useful<br>
special cases easy (as opposed to the generality of `regexp-split').<br></blockquote><div><br>Then instead of #f one idea is to go one step further and consider different useful cases based on input symbols like 'whitespaces, 'non-alpha, etc. ? Or even a list of string/symbols that can be used as a splitter.<br>
That would make a more powerful function for sure. (It's just that I'm troubled by the uniqueness of this magical default argument)<br><br>Laurent<br><br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
> It would then appear somewhat magical. To me the " " default splitter seems<br>
> more intuitive.<br>
><br>
> Laurent<br>
><br>
><br>
> > and the two-argument case should be as Laurent<br>
> > wrote. (Probably the optional second argument should be string-or-#f,<br>
> > where #f means to use #px"\\s+".)<br>
> ><br>
> > At Thu, 19 Apr 2012 14:30:31 +0200, Laurent wrote:<br>
> > > (define (string-split str [sep #px"\\s+"])<br>
> > > > (remove* '("") (regexp-split sep str)))<br>
> > > ><br>
> > ><br>
> > > Nearly, I meant something more like this:<br>
> > ><br>
> > > (define (string-split str [splitter " "])<br>
> > > (regexp-split (regexp-quote splitter) str))<br>
> > ><br>
> > > No regexp from the user POV, and much easier to use with little<br>
> > knowledge.<br>
> > > _________________________<br>
> > > Racket Developers list:<br>
> > > <a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
> ><br>
</div></div></blockquote></div><br>