Thanks, that was exactly it.
On Mon, Mar 23, 2020 at 3:51 PM Michael MacLeod
wrote:
>
> I think you are looking for parameter/c. See
> https://docs.racket-lang.org/reference/data-structure-contracts.html?q=parameterof#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._parameter%2Fc%2
AFK, but it looks like the contract and function on your define/contract
are swapped. Maybe the contract check on the one-arg call sets the
parameter and then hilarity ensues?
Eric
On Mon, Mar 23, 2020, 12:36 PM David Storrs wrote:
> (define/contract (foo x)
> (-> boolean? any)
> 'ok)
>
>
On 3/23/20, David Storrs 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: to
(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: read
4 matches
Mail list logo