On Sat, Oct 29, 2011 at 4:27 AM, MingQian Zhang <zmingq...@qq.com> wrote: > Hi all: > I am a rookie to racket who used to write some ruby scripts. > Now I meet some problem about how to download a URL and print it or deal the > result as a String. > I write like this: > #lang racket > (require net/url) > (define (get url) > (get-impure-port (string->url url))) > Then run: >> (read (get "http://www.google.com")) > 'HTTP/1.0 >> > Only output part of the total response. > I am confused about this.
The problem here is that `read' a specialized procedure for reading a certain kind of data, called s-expressions. You just want to read whatever Google sends you over the port. > How can I read and print all the response page? Here's a fixed version: #lang racket (require net/url) (define (get url) (get-impure-port (string->url url))) (port->lines (get "http://www.google.com")) > Can anyone explain this ? > Thanks very much! > By the way, as a stater on this language ,I found the racket docs very > useful. > But sometime can't understand the reference and don't know how people use > these functions. > Are there any source code using racket to read? Have you looked at the "Guide" documentation? It's a lot easier for new Racket programmers than the Reference? http://docs.racket-lang.org/guide/index.html -- sam th sa...@ccs.neu.edu _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users