<div dir="ltr">On Mon, Oct 6, 2008 at 7:25 PM, Eli Barzilay <span dir="ltr"><<a href="mailto:eli@barzilay.org">eli@barzilay.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Oct 7, Noel Welsh wrote:<br>
> You could make your regexp match to the end of the line (using the $<br>
> symbol IIRC) or you could convert the file to a list of strings and<br>
> match on those. For the later the port->string-list function in the<br>
> port.plt package on PLaneT will help.<br>
<br>
</div>As a side note, that function is easy to define using either<br>
`for/list':<br>
<br>
(define (port->string-list port)<br>
(for/list ([l (in-lines port)]) l))<br>
<br>
or `regexp-split':<br>
<br>
(define (port->string-list port)<br>
(map bytes->string/utf-8 (regexp-split #rx"\r?\n" port)))<br>
<br>
<br>
And, as long as I'm looking at that file, the quick-n-dirty hack can<br>
fail in unexpected ways:<br>
<br>
> (port->sexp-list (open-input-string "1 2 3) 4"))<br>
(1 2 3)<br>
> (port->sexp-list (open-input-string "#z 1 2 3"))<br>
UNKNOWN::1: read: bad syntax `#z'<br>
<br>
the location is off-by-1 in that last example.<br>
<br>
> (port->sexp-list (open-input-string "1 2 3 #"))<br>
UNKNOWN::7: read: bad syntax `#)'<br>
> (port->sexp-list (open-input-string "1 2 3 ["))<br>
UNKNOWN::8: read: unexpected `)'<br>
<br>
these examples expose the fake parens.<br>
<br>
And finally, all of these:<br>
<br>
(port->sexp-list (open-input-string "1 2 3 ("))<br>
(port->sexp-list (open-input-string "1 2 3 #\"))<br>
(port->sexp-list (open-input-string "1 2 3 \\"))<br>
(port->sexp-list (open-input-string "1 2 3 \""))<br>
<br>
will just get stuck.<br>
<div><div></div><div class="Wj3C7c"><br>
--<br>
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:<br>
<a href="http://www.barzilay.org/" target="_blank">http://www.barzilay.org/</a> Maze is Life!<br>
</div></div></blockquote></div><br>Thanks for the info. I'll go play with this now.<br clear="all"><br>-- Eli<br><br>You can meet at his location,<br>but you better come with cash.<br>-- Cake<br>
</div>