the relationship between a class and its clients as a formal agreement, expressing each party's rights and obligations
The contract
macro is the lowest level construct provided by Trammel, but it is not likely to be broadly useful given that it defines anonymous contracts. However, you might find the defcontract
macro much more agreeable, especially in concert with with-constraints
and provide-contracts
:
(defcontract sqr-contract "Defines the constraints for squaring" [n] [number? (not= 0 n) => pos? number?])