On this page:
define-flat-rec-contract
dict/  c
nat/  c
type-predicate/  c
8.12

7.2 mischief/contract: Contracts🔗ℹ

 (require mischief/contract) package: mischief

This module re-exports predicate/c from racket/contract.

syntax

(define-flat-rec-contract name-id contract-expr ...)

Defines a flat, recursive contract named name-id that accepts any of the contract-expr variants.

procedure

(dict/c key/c val/c)  contract?

  key/c : contract?
  val/c : contract?
Contract for dictionaries with keys contracted by key/c and values contracted by val/c. Currently implemented as an impersonator contract regardless of the values of key/c and val/c.

An alias for natural-number/c.

procedure

(type-predicate/c [input/c    
  #:strict? strict?]    
  #:super super)  contract?
  input/c : contract? = any/c
  strict? : boolean? = #true
  super : (or/c predicate/c #false)
Produces a contract for predicate functions. With no arguments, equivalent to predicate/c. The predicate’s argument is contracted by input/c. If strict? is #true, its result must be a boolean; otherwise it can be any value. If super is a predicate, then the contracted predicate must only accept values that super also accepts.