[racket-dev] What is handle in racket?
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