I am walking through the racket guide and just finished this page:
https://docs.racket-lang.org/guide/contracts-first.html
And the resulting contract is so convoluted that I couldn't believe my eyes:
(provide
(contract-out
[argmax
(->i ([f (-> any/c real?)] [lov (and/c pair? list?)]) ()
(r (f lov)
(lambda (r)
(cond
[(empty? (rest lov)) (eq? (first lov) r)]
[else
(define f@r (f r))
(define flov (map f lov))
(and (is-first-max? r f@r (map list lov flov))
(dominates-all f@r flov))]))))]))
I bet this contract has reached much higher complexity than the needed actual implementation, though this contract doesn't in fact reveal any implementation details. What baffles me more is that the contract is not even a compile time component, like a proof of properties via type system by Curry-Howard isomorphism, so it's not in any sense certified programming approach and defintiely comes with a runtime effect. With this level of complexity, I see no benefit of doing contract more than, say some simple data type checking, which I can see more sense about it.
Could you point out where I am missing about the necessity of such kind of contract?r