David Storrs
未讀,2020年3月23日 下午3:36:392020/3/23登入以回覆作者
登入以轉寄訊息
你的權限不足,無法在這個群組刪除訊息
登入以檢舉訊息
該群組的電子郵件地址為匿名,或你需要檢視成員電子郵件地址的權限才能查看原始貼文
收件者:Racket Users
(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?