Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.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,Racket有一个非空的合约列表,但没有非空的合约列表。有没有办法构建一个谓词?谓词可以用作契约,因此: (define (non-empty-hash? x) (and (hash? x) (not (hash-empty? x)))) 然后您可以使用非空散列?作为您的合同。原始问答:

Racket有一个
非空的
合约列表,但没有
非空的
合约列表。有没有办法构建一个谓词?

谓词可以用作契约,因此:

(define (non-empty-hash? x)
  (and (hash? x)
       (not (hash-empty? x))))
然后您可以使用
非空散列?
作为您的合同。

原始问答: