unconstrained-domain->

http://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._unconstrained-domain-~3e%29%29


On Tue, Jun 13, 2017 at 11:24 AM, David Storrs <david.sto...@gmail.com>
wrote:

> Suppose the following trivial function:
>
> (define/contract (foo func)
>   (-> (-> any/c ... any/c) #t)
>   #t)
>
> This is trying (and failing) to express the idea "foo takes a processor
> function.  I don't care what arguments the processor requires (that's the
> caller's job) but the processor must return a singular result."
>
> What would be the correct contract for foo?  I've been through the section
> on function contracts; the above was my first guess but this fails:
>
> (foo identity)
> ; foo: contract violation
> ;   expected: a procedure that accepts 0 non-keyword arguments and
> arbitrarily
> ;     many more
> ;   given: #<procedure:identity>
> ;   identity accepts: 1 argument
> ;   in: the 1st argument of
> ;       (-> (-> any/c ... any/c) #t)
> ;   contract from: (function foo)
> ;   blaming: top-level
> ;    (assuming the contract is correct)
> ;   at: readline-input:8.18
> ; [,bt for context]
> ->
>
>
> I also tried this, which apparently isn't even legal syntax:
>
> (define/contract (foo func)
>   (-> (-> any any/c) #t)
>   #t)
> ; readline-input:10:33: any: use of 'any' outside the range of an arrow
> ;   contract
> ;   in: any
> ; [,bt for context]
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to