[plt-scheme] The contract

From: yug at ios.ac.cn (yug at ios.ac.cn)
Date: Mon Dec 17 09:44:15 EST 2007

I do not use the interface from net collection, Module "ssl-url" was
provided by Jens,

(call/input-url (opt->* (url?
                            (opt-> (url?) ((listof string?)) input-port?)
                            (input-port? . -> . any))
                           ((listof string?))
                           any))


BTW, I have tried several times to upgrade to current SVN, but the redex
code (3.28) I wrote on version 371 could not run anymore on 3.99 or later.
So I prefer staying on 371.2



On Dec 17, 2007 10:34 PM, Robby Findler <robby at cs.uchicago.edu> wrote:

> Oh, one other point. It was pointed out earlier that the function does
> not actually need that strict of a contract and I believe the contract
> has been relaxed in SVN.
>
> Robby
>
> On Dec 17, 2007 8:22 AM,  <yug at ios.ac.cn> wrote:
> > Thanks!! Robby
> >
> > The right def is
> >
> >
> > (call/input-url (string->url "https://210.77.16.29/php/user_login.php")
> >                   (case-lambda
> >                      [(url) (post-impure-port url data rhead)]
> >                     [(url rhead) (post-impure-port url data rhead)])
> >                   display-pure-port
> >                   )
> >
> >
> >
> >  On Dec 17, 2007 10:15 PM, Robby Findler <robby at cs.uchicago.edu> wrote:
> > > The contract is insisting that you provide a function that accepts
> > > *both* one argument and two arguments.
> > >
> > > Robby
> > >
> > >
> > >
> > >
> > > On Dec 17, 2007 8:13 AM,  < yug at ios.ac.cn> wrote:
> > > > 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
> > > > _________________________________________________
> > > >   For list-related administrative tasks:
> > > >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> > > >
> > > >
> > > _________________________________________________
> > >  For list-related administrative tasks:
> > >  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> > >
> >
> >
> >
> > --
> > Gang
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>



-- 
Gang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20071217/1d1751f6/attachment.html>

Posted on the users mailing list.