This is what ->i is for. The syntax of define/contract is slightly
misleading because it appears to place the contracts in scope of the
arguments but, as you notice, it doesn't. Happily ->i lets you give another
name to the argument and then you can use that one.

Robby

On Thu, Jul 18, 2019 at 10:48 PM Kevin Forchione <lyss...@gmail.com> wrote:

> Hi guys,
> This is a little tricky to explain, so I’ll give a small example:
>
> [define/contract [foo x) (-> integer? not-x/c) body …)
>
> In this case the not-x/c is what I’m asking about. Some way that the
> contract can refer to a previous argument value? Ordinarily this would be a
> predicate, but the parameters don’t appear to be in the scope of the
> contract. so ((λ (v) (not (= v x))) won’t work here, but it gets at the
> issue I”m interested in. I could of course interrogate the arguments inside
> the body of the function, but was wondering if a contract could do so.
>
> Kevin
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/33F99A77-8609-4C37-AF59-E407A38A066A%40gmail.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL3TdON%2Bi7YfAxrPovgjBLigM8zSp5ECH3nBLjd3HE4BFGWsxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to