[plt-scheme] Renaming of contract names
--- 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?
I think 'any' (and thus, 'obj?' here) is only allowed on the
right-hand side of arrow contracts. Contracts such as
(list? . -> . obj?)
seem to be fine.
Ryan
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com