Thanks!! Robby<br><br>The right def is <br><br>(call/input-url (string->url "<a href="https://210.77.16.29/php/user_login.php">https://210.77.16.29/php/user_login.php</a>")<br> (case-lambda<br>
[(url) (post-impure-port url data rhead)]<br> [(url rhead) (post-impure-port url data rhead)])<br> display-pure-port<br> )<br><br><div class="gmail_quote">
On Dec 17, 2007 10:15 PM, Robby Findler <<a href="mailto:robby@cs.uchicago.edu">robby@cs.uchicago.edu</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The contract is insisting that you provide a function that accepts<br>*both* one argument and two arguments.<br><br>Robby<br><div><div></div><div class="Wj3C7c"><br>On Dec 17, 2007 8:13 AM, <<a href="mailto:yug@ios.ac.cn">
yug@ios.ac.cn</a>> wrote:<br>> Hi,<br>><br>> I'm fresh to contracts. Here is my problem:<br>><br>> I just want to pass the contracts check on the following definition:<br>><br>> (define test (lambda (url)
<br>> (post-impure-port url data rhead)))<br>><br>> (provide/contract (test (-> url? input-port?)))<br>><br>> (call/input-url (string->url "<a href="https://210.77.16.29/php/user_login.php" target="_blank">
https://210.77.16.29/php/user_login.php</a>") test<br>> display-pure-port)<br>><br>> or even more simplified:<br>><br>> (call/input-url (string->url "<a href="https://210.77.16.29/php/user_login.php" target="_blank">
https://210.77.16.29/php/user_login.php</a>")<br>> (lambda (url)<br>> (post-impure-port url data rhead)))<br>> display-pure-port)<br>><br>> Every time, I get:
<br>> (case-><br>> (-><br>> url?<br>> (case-><br>> (-> url? input-port?)<br>> (-> url? (listof string?) input-port?))<br>> (-> input-port? any)<br>
> any)<br>> (-><br>> url?<br>> (case-><br>> (-> url? input-port?)<br>> (-> url? (listof string?) input-port?))<br>> (-> input-port? any)<br>> (listof string?)
<br>> any))<br>> on call/input-url; expected a procedure that accepts 2 arguments, given:<br>> #<procedure:test><br>><br>> If I change the definition to<br>> (call/input-url (string->url "
<a href="https://210.77.16.29/php/user_login.php" target="_blank">https://210.77.16.29/php/user_login.php</a>")<br>> (lambda (url rhead)<br>> (post-impure-port url data rhead)
<br>> )<br>> display-pure-port<br>> )<br>> . . ssl-url.scm:40:4: /home/yug/ssl-url.scm:40:4: top-level broke the<br>> contract<br>> (case-><br>
> (-><br>> url?<br>> (case-><br>> (-> url? input-port?)<br>> (-> url? (listof string?) input-port?))<br>> (-> input-port? any)<br>> any)<br>> (->
<br>> url?<br>> (case-><br>> (-> url? input-port?)<br>> (-> url? (listof string?) input-port?))<br>> (-> input-port? any)<br>> (listof string?)<br>> any))
<br>> on call/input-url; expected a procedure that accepts 1 arguments, given:<br>> #<procedure><br>> ><br>><br>> How can I define my function?<br>><br>> Thanks<br>><br>> --<br>> Gang
<br></div></div>> _________________________________________________<br>> For list-related administrative tasks:<br>> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme
</a><br>><br>><br>_________________________________________________<br> For list-related administrative tasks:<br> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme
</a><br></blockquote></div><br><br clear="all"><br>-- <br>Gang