Skip to content

Commit

Permalink
Cleanedup contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
endobson committed Oct 24, 2011
1 parent bb14e70 commit f9e25de
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions private/simple/util.rkt
@@ -1,19 +1,34 @@
#lang racket/base

(require racket/contract)
(provide list*/c non-empty-list*/c power-of-two?)
(require
racket/contract
unstable/contract)
(provide
(contract-out
(list*/c (-> contract? contract?))
(non-empty-list*/c (-> contract? contract?))
(power-of-two? predicate/c)))

(define (list*/c ctc)
(if (flat-contract? ctc)
(flat-rec-contract rec
(cons/c ctc rec)
(list/c (listof ctc)))
(let ()
(define rec
(recursive-contract
(or/c (cons/c ctc rec)
(list/c (listof ctc)))))
rec)))
(cond
((flat-contract? ctc)
(flat-rec-contract rec
(cons/c ctc rec)
(list/c (listof ctc))))
((chaperone-contract? ctc)
(define rec
(recursive-contract
(or/c (cons/c ctc rec)
(cons/c (listof ctc) null))
#:chaperone))
rec)
(else
(define rec
(recursive-contract
(or/c (cons/c ctc rec)
(cons/c (listof ctc) null))))
rec)))



(define (non-empty-list*/c ctc)
Expand Down

0 comments on commit f9e25de

Please sign in to comment.