meta/new-web: adjust one example to use define instead of let*

This commit is contained in:
Matthew Flatt 2014-03-08 20:42:47 -07:00
parent 38322f7202
commit d5c724d56e

View File

@ -132,10 +132,10 @@
@code{#lang racket ; Simple web scraper @code{#lang racket ; Simple web scraper
(require net/url net/uri-codec) (require net/url net/uri-codec)
(define (let-me-google-that-for-you str) (define (let-me-google-that-for-you str)
(let* ([g "http://www.google.com/search?q="] (define g "http://www.google.com/search?q=")
[u (string-append g (uri-encode str))] (define u (string-append g (uri-encode str)))
[rx #rx"(?<=<h3 class=\"r\">).*?(?=</h3>)"]) (define rx #rx"(?<=<h3 class=\"r\">).*?(?=</h3>)")
(regexp-match* rx (get-pure-port (string->url u)))))} (regexp-match* rx (get-pure-port (string->url u))))}
@desc{Add a call to @elemcode{let-me-google-that-for-you} to get a list of @desc{Add a call to @elemcode{let-me-google-that-for-you} to get a list of
search results.}) search results.})
(cmdline-example #:title "Command Line Dice"; ----------------------------------------------- (cmdline-example #:title "Command Line Dice"; -----------------------------------------------