[plt-scheme] Higher-order contracts for variable-arity functions
Is there a way to apply function contracts to the elements of "rest"
arguments? Let's say I had a simple "compose" function that operated
on any number of functions, each with one argument and one return
value. I might try to write its contract like this:
(module stuff mzscheme
(require (lib "contract.ss"))
(provide/contract
[compose ([(any/c . -> . any/c)] (listof (any/c . -> . any/c)) .
->* . [(any/c . -> . any/c)])])
(define (compose f . rest)
...)
)
The problem here is that "listof" does not take higher-order
contracts. I don't see any contract utilities that treat "rest"
arguments as anything other than a list. Have I missed one? Is there
a way to write one?
--
Carl Eastlund
"Cynical, but technically correct."