I’ve been having problems with but-not/e, and I’ve been bouncing between 
strange things, but this one really looks ilke a bug. Unless it’s not.

John

#lang racket

(require data/enumerate
         data/enumerate/lib)

(define (even-mod-10? x) (= 0 (modulo x 10)))

(define tens/e
  (map/e (λ (x) (* x 10))
         (λ (x) (/ x 10))
         natural/e
         #:contract (and/c natural?
                           even-mod-10?)))


(define test/e (but-not/e tens/e (range/e 1000 2000)))
(enum->list test/e 10)

(to-nat test/e 10) 

;; produces:

map/e: broke its own contract
  promised: even-mod-10?
  produced: 1001
  in: an and/c case of
      the 1st argument of
      the out argument of
      (->i
       ((in
         (e es c)
         (cond
          ((null? es) (-> (enum-contract e) c))
          (else
           (dynamic->*
            #:mandatory-domain-contracts
            (map enum-contract ...)
            #:range-contracts
            (list c)))))
        (out
         (e es c)
         (cond
          ((null? es) (-> c (enum-contract e)))
          (else
           (dynamic->*
            #:mandatory-domain-contracts
            (list c)
            #:range-contracts
            (map enum-contract ...)))))
        (e enum?)
        #:contract
        (c contract?))
       #:rest
       (es (listof enum?))
       #:pre/desc
       (in out e es)
       (appears-to-be-a-bijection?
        in
        out
        (cons e es))
       (result enum?))
  contract from: 
      <pkgs>/data-enumerate-lib/data/enumerate.rkt
  blaming: <pkgs>/data-enumerate-lib/data/enumerate.rkt
   (assuming the contract is correct)
  at: <pkgs>/data-enumerate-lib/data/enumerate.rkt:45.3

-- 
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