[plt-scheme] The contract
Hi,
I'm fresh to contracts. Here is my problem:
I just want to pass the contracts check on the following definition:
(define test (lambda (url)
(post-impure-port url data rhead)))
(provide/contract (test (-> url? input-port?)))
(call/input-url (string->url "https://210.77.16.29/php/user_login.php") test
display-pure-port)
or even more simplified:
(call/input-url (string->url "https://210.77.16.29/php/user_login.php")
(lambda (url)
(post-impure-port url data rhead)))
display-pure-port)
Every time, I get:
(case->
(->
url?
(case->
(-> url? input-port?)
(-> url? (listof string?) input-port?))
(-> input-port? any)
any)
(->
url?
(case->
(-> url? input-port?)
(-> url? (listof string?) input-port?))
(-> input-port? any)
(listof string?)
any))
on call/input-url; expected a procedure that accepts 2 arguments, given:
#<procedure:test>
If I change the definition to
(call/input-url (string->url "https://210.77.16.29/php/user_login.php")
(lambda (url rhead)
(post-impure-port url data rhead)
)
display-pure-port
)
. . ssl-url.scm:40:4: /home/yug/ssl-url.scm:40:4: top-level broke the
contract
(case->
(->
url?
(case->
(-> url? input-port?)
(-> url? (listof string?) input-port?))
(-> input-port? any)
any)
(->
url?
(case->
(-> url? input-port?)
(-> url? (listof string?) input-port?))
(-> input-port? any)
(listof string?)
any))
on call/input-url; expected a procedure that accepts 1 arguments, given:
#<procedure>
>
How can I define my function?
Thanks
--
Gang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20071217/d5bc206b/attachment.html>