[racket-dev] What is handle in racket?

From: Insik Cho (iminsik at gmail.com)
Date: Fri Jan 21 08:07:21 EST 2011

hi guys,

I have used 'call/input-url' function frequently, whose definition is:

(call/input-url URL connect handle) → any
URL : url?
connect : (url? . -> . input-port?)
handle : (input-port? . -> . any)

I coded like:

(define a-url (string->url "http://www.google.com"))
(call/input-url a-url get-pure-port (lambda (p) (display (read-bytes 
1024 p))))

Tired to type 'lambda' function, I extracted it like:

(define a-url (string->url "http://www.google.com"))
(define (read-1024 p) (display (read-bytes 1024 p)))
(call/input-url a-url get-pure-port (read-1024 p))

But, it generates errors.

What's wrong?
The question is: what 'handle' means?
Is it like a callback function in C?

Thanks in advance.

- Joe





Posted on the dev mailing list.