From: Grant Rettke (grettke at acm.org) Date: Sun Mar 22 12:01:45 EDT 2009 |
|
Is the best way to write a contract for a function that takes a list of natural numbers of length >= 2 and outputs a list of natural numbers that is the same length as the input? (->d ([argument (and/c (flat-named-contract 'arg-len->=2-required (λ (ls) (>= (length ls) 2))) (listof natural-number/c))]) () (result (and/c (flat-named-contract 'res-len-must-match-arg-len (λ (ls) (= (length ls) (length argument)))) (listof natural-number/c))))
Posted on the users mailing list. |
|