;; Indents a multi-line string by n spaces #lang racket (define (indent str n) (define blanks (make-string n #\space)) (string-join (for/list ([line (regexp-split #"\n" str)]) (format "~a~a" blanks line)) "\n"))
;; Another attempt at shrinking the google query example. Is this still too wide? #lang racket (require net/url net/uri-codec) (define (google-query q) (let ([g "http://www.google.com/search?q="] [u (string-append g (uri-encode q))] [rx #rx"(?<=<h3 class=\"r\">).*?(?=</h3>)"]) (regexp-match* rx (get-pure-port (string->url u))))) _________________________________________________ For list-related administrative tasks: http://list.cs.brown.edu/mailman/listinfo/plt-dev