[racket-dev] `string-split'

From: Laurent (laurent.orseau at gmail.com)
Date: Thu Apr 19 09:35:26 EDT 2012

> >     4. Related to Q3: what does "xy" as that argument mean exactly?
> >       a. #rx"[xy]"
> >       b. #rx"[xy]+"
> >       c. #rx"xy"
> >       d. #rx"(?:xy)+"
> >
> > Good question. d. would be the simplest case for newbies, but
> > b. might be more useful.  I think several other languages avoid this
> > issue by using only one character as the separator.
> The complication is that with " " or " \t" it seems that you'd want b,
> and with "&" you'd want c.  (Maybe even make "&" equivalent to
> #rx" *& *" -- that looks like it's too much guessing.)
> And you're also making a point for:
>  e. Throw an error, must be a single-character string.
> BTW, this question is important because it affects other functions, so
> I'd like to resolve it before doing anything.

If we make things as simple-but-useful as possible, then I'd go for a
single char separator with option b/d. (I don't think there are many cases
where one would want a string as a separator?)
Personally, I don't like much when functions ask for a character because
the #\ looks ugly to me, but it still makes more sense than asking for a
string that must have a single character.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20120419/adf9bc38/attachment.html>

Posted on the dev mailing list.