[plt-scheme] Renaming of contract names
Yeah, that's supposed to happen. "any" is a local keyword for -> and
only works in the range position. Use it when you want to make sure
your function remains tail-recursive. The actual any contract is
any/c, so you wanted this, I think:
(provide/contract [empty? (-> any/c boolean?)])
Robby
On 4/28/07, Jens Axel Søgaard <jensaxel at soegaard.net> wrote:
> Hi all,
>
> I working on random access lists. I'd like to implement all
> operations from srfi 1 including "any". Since (lib "contract.ss")
> contains a contract called "any", I tried renaming it on import:
>
> (module a-module mzscheme
> (require (all-except (lib "contract.ss") any)
> (rename (lib "contract.ss") obj? any))
>
> (provide/contract
> [empty? (obj? . -> . boolean?)])
>
> (define empty? null?)
>
> (define (any pred xs)
> (cond [(null? xs) #f]
> [(pred (car xs)) #t]
> [else (any (cdr xs))]))
>
> (display (any even? (list 1 2 3 4 5 6)))
> (newline))
>
> But nevertheless I get the error:
>
> any: Use any out of an arrow contract in: obj?
>
> Is this supposed to happen?
>
> --
> Jens Axel Søgaard
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>