On 3/23/20, David Storrs <[email protected]> wrote:
> (define/contract (foo x)
>   (-> boolean? any)
>   'ok)
>
> (foo #t)
> 'ok
> (foo 7)
> ; foo: contract violation
> ;   expected: boolean?
> ;   given: 7
> ;   in: the 1st argument of
> ;       (-> boolean? any)
> ;   contract from: (function foo)
> ;   blaming: top-level
> ;    (assuming the contract is correct)
> ;   at: readline-input:4.18
> ; [,bt for context]
>
> Yup, all good.
>
>
> (define/contract foo (make-parameter #f) boolean?)
> (foo #t)
> (foo)
> #t
> (foo 7)
> #f
>
>
> This isn't what I expected.  What am I missing?

1. the contract comes first, right now foo = boolean?

2. try parameter/c

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFUu9R6RrEG-oK1i4fOsF9qUJFrbGc5TiMHPG--38cbvfdZsjQ%40mail.gmail.com.

Reply via email to