Thanks!! Robby<br><br>The right def is <br><br>(call/input-url (string-&gt;url &quot;<a href="https://210.77.16.29/php/user_login.php">https://210.77.16.29/php/user_login.php</a>&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (case-lambda<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [(url) (post-impure-port url data rhead)]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [(url rhead) (post-impure-port url data rhead)])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; display-pure-port<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br><br><div class="gmail_quote">
On Dec 17, 2007 10:15 PM, Robby Findler &lt;<a href="mailto:robby@cs.uchicago.edu">robby@cs.uchicago.edu</a>&gt; 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, &nbsp;&lt;<a href="mailto:yug@ios.ac.cn">
yug@ios.ac.cn</a>&gt; wrote:<br>&gt; Hi,<br>&gt;<br>&gt; &nbsp; I&#39;m fresh to contracts. Here is my problem:<br>&gt;<br>&gt; I just want to pass the contracts check on the following definition:<br>&gt;<br>&gt; &nbsp;(define test (lambda (url)
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(post-impure-port url data rhead)))<br>&gt;<br>&gt; (provide/contract (test (-&gt; url? input-port?)))<br>&gt;<br>&gt; (call/input-url (string-&gt;url &quot;<a href="https://210.77.16.29/php/user_login.php" target="_blank">
https://210.77.16.29/php/user_login.php</a>&quot;) test<br>&gt; display-pure-port)<br>&gt;<br>&gt; or even more simplified:<br>&gt;<br>&gt; (call/input-url (string-&gt;url &quot;<a href="https://210.77.16.29/php/user_login.php" target="_blank">
https://210.77.16.29/php/user_login.php</a>&quot;)<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(lambda (url)<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(post-impure-port url data rhead)))<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display-pure-port)<br>&gt;<br>&gt; Every time, I get:
<br>&gt; &nbsp; (case-&gt;<br>&gt; &nbsp; &nbsp; (-&gt;<br>&gt; &nbsp; &nbsp; &nbsp;url?<br>&gt; &nbsp; &nbsp; &nbsp;(case-&gt;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;(-&gt; url? input-port?)<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;(-&gt; url? (listof string?) input-port?))<br>&gt; &nbsp; &nbsp; &nbsp;(-&gt; input-port? any)<br>
&gt; &nbsp; &nbsp; &nbsp;any)<br>&gt; &nbsp; &nbsp; (-&gt;<br>&gt; &nbsp; &nbsp; &nbsp;url?<br>&gt; &nbsp; &nbsp; &nbsp;(case-&gt;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;(-&gt; url? input-port?)<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;(-&gt; url? (listof string?) input-port?))<br>&gt; &nbsp; &nbsp; &nbsp;(-&gt; input-port? any)<br>&gt; &nbsp; &nbsp; &nbsp;(listof string?)
<br>&gt; &nbsp; &nbsp; &nbsp;any))<br>&gt; on call/input-url; expected a procedure that accepts 2 arguments, given:<br>&gt; #&lt;procedure:test&gt;<br>&gt;<br>&gt; If I change the definition to<br>&gt; (call/input-url (string-&gt;url &quot; 
<a href="https://210.77.16.29/php/user_login.php" target="_blank">https://210.77.16.29/php/user_login.php</a>&quot;)<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (lambda (url rhead)<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (post-impure-port url data rhead)
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display-pure-port<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br>&gt; . . ssl-url.scm:40:4: /home/yug/ssl-url.scm:40:4: top-level broke the<br>&gt; contract<br>&gt; &nbsp; (case-&gt;<br>
&gt; &nbsp; &nbsp; (-&gt;<br>&gt; &nbsp; &nbsp; &nbsp;url?<br>&gt; &nbsp; &nbsp; &nbsp;(case-&gt;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;(-&gt; url? input-port?)<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;(-&gt; url? (listof string?) input-port?))<br>&gt; &nbsp; &nbsp; &nbsp;(-&gt; input-port? any)<br>&gt; &nbsp; &nbsp; &nbsp;any)<br>&gt; &nbsp; &nbsp; (-&gt;
<br>&gt; &nbsp; &nbsp; &nbsp;url?<br>&gt; &nbsp; &nbsp; &nbsp;(case-&gt;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;(-&gt; url? input-port?)<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;(-&gt; url? (listof string?) input-port?))<br>&gt; &nbsp; &nbsp; &nbsp;(-&gt; input-port? any)<br>&gt; &nbsp; &nbsp; &nbsp;(listof string?)<br>&gt; &nbsp; &nbsp; &nbsp;any))
<br>&gt; on call/input-url; expected a procedure that accepts 1 arguments, given:<br>&gt; #&lt;procedure&gt;<br>&gt; &gt;<br>&gt;<br>&gt; How can I define my function?<br>&gt;<br>&gt; Thanks<br>&gt;<br>&gt; --<br>&gt; Gang
<br></div></div>&gt; _________________________________________________<br>&gt; &nbsp; For list-related administrative tasks:<br>&gt; &nbsp; <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme
</a><br>&gt;<br>&gt;<br>_________________________________________________<br> &nbsp;For list-related administrative tasks:<br> &nbsp;<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