Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Racket 只关心返回值的函数的契约?_Racket_Contract - Fatal编程技术网

Racket 只关心返回值的函数的契约?

Racket 只关心返回值的函数的契约?,racket,contract,Racket,Contract,假设以下平凡函数: (define/contract (foo func) (-> (-> any/c ... any/c) #t) #t) 这试图(但失败)表达“foo接受处理器函数。我不在乎处理器需要什么参数(这是调用方的工作),但处理器必须返回一个单一的结果。” foo的正确合同是什么?我已经浏览了功能合同部分;以上是我的第一个猜测,但这失败了: (foo identity) ; foo: contract violation ; expected: a proc

假设以下平凡函数:

(define/contract (foo func)
  (-> (-> any/c ... any/c) #t)
  #t)
这试图(但失败)表达“foo接受处理器函数。我不在乎处理器需要什么参数(这是调用方的工作),但处理器必须返回一个单一的结果。”

foo的正确合同是什么?我已经浏览了功能合同部分;以上是我的第一个猜测,但这失败了:

(foo identity)
; foo: contract violation
;   expected: a procedure that accepts 0 non-keyword arguments and arbitrarily
;     many more
;   given: #<procedure:identity>
;   identity accepts: 1 argument
;   in: the 1st argument of
;       (-> (-> any/c ... any/c) #t)
;   contract from: (function foo)
;   blaming: top-level
;    (assuming the contract is correct)
;   at: readline-input:8.18
; [,bt for context]
我想你想要原版问答:
(define/contract (foo func)
  (-> (-> any any/c) #t)
  #t)
; readline-input:10:33: any: use of 'any' outside the range of an arrow
;   contract
;   in: any
; [,bt for context]