[plt-dev] Racket web page
On Sat, May 22, 2010 at 5:55 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>
> I'm disappointed that we're getting so few 7-line program suggestions.
> Please suggest more.
>
Fun with net and regular expressions:
#lang racket
(require net/url net/uri-codec)
(define (let-me-google-that-for-you term)
(define google-url
(string->url (string-append "http://www.google.com/search?q="
(uri-encode term))))
(regexp-match* #rx"(?<=<h3 class=\"r\">).*?(?=</h3>)" (get-pure-port
google-url)))
(let-me-google-that-for-you "racket language")
N.