[racket] Use regexps or something else?

From: Rodolfo Carvalho (rhcarvalho at gmail.com)
Date: Sat Jun 4 00:50:24 EDT 2011

So for now I have this, that does what I want:


#lang racket
(define t
"================================================================================

[.... omitted for brevity ...]

T/V                N    NB     P     Q               Time
Gflops
--------------------------------------------------------------------------------
WR00L2L4       29293   256     1     8             452.13
 3.707e+01
--------------------------------------------------------------------------------
||Ax-b||_oo/(eps*(||A||_oo*||x||_oo+||b||_oo)*N)=        0.0027608 ......
PASSED
================================================================================
T/V                N    NB     P     Q               Time
Gflops
--------------------------------------------------------------------------------
WR00L2L4       29293   256     2     4             535.64
 3.129e+01
--------------------------------------------------------------------------------
||Ax-b||_oo/(eps*(||A||_oo*||x||_oo+||b||_oo)*N)=        0.0034782 ......
PASSED
================================================================================")

(define (parse-line line)
  (map string->number (regexp-split #px"\\s+" line)))

(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?

Rodolfo Carvalho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110604/d5d9d543/attachment.html>

Posted on the users mailing list.