[racket] Use regexps or something else?

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Jun 4 11:43:17 EDT 2011

11 hours ago, Rodolfo Carvalho wrote:
> (sort
>  (map parse-line (regexp-match*
> #px"\\d+\\s+\\d+\\s+\\d\\s+\\d+\\s+\\d+(\\.\\d+)?\\s+[\\d.e+]+" t))
>  >
>  #:key last
>  #:cache-keys? #t)
> 
> I tried to improve the regexp but it breaks my notion of "line".
> 
> Any suggestions?

Use `in-lines' to grab one line at a time from an input port (or
`regexp-split' a string over #rx"\n"); for each line, match it against
a regexp pattern for single lines -- if it matches, do what you need
with the result, otherwise ignore it.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.