<div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">
</div>Continuing with this line, it seems that a better definition is as<br>
follows:<br>
<br>
(define (string-split str [sep " "])<br>
(remove* '("") (regexp-split (regexp-quote (or sep " ")) str)))<br>
<br>
Except that the full definition could be a bit more efficient.<br>
<br>
Three questions:<br>
<br>
1. Laurent: Does this make more sense?<br></blockquote><div><br>Yes, this definitely makes more sense to me.<br>It would then treat (string-split "aXXbXXXXy" "X") just like the " " case.<br>
<br>Although if you want to find the columns of a latex line like "x && y & z" you will have the wrong result.<br>Maybe use an optional argument to remove the empty strings? (not sure)<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
2. Matthew: Is there any reason to make the #f-as-default part of the<br>
interface? (Even with the new reply I don't see a necessity for<br>
this -- if the target is newbies, then I think that keeping it as a<br>
string is simpler...)<br></blockquote><div><br>There is probably no need for #f with the new spec. <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">
4. Related to Q3: what does "xy" as that argument mean exactly?<br>
a. #rx"[xy]"<br>
b. #rx"[xy]+"<br>
c. #rx"xy"<br>
d. #rx"(?:xy)+"<br></blockquote><div><br>Good question. d. would be the simplest case for newbies, but b. might be more useful.<br>I think several other languages avoid this issue by using only one character as the separator.<br>
</div></div><br>Laurent<br>