Add NonemptyListof.
This commit is contained in:
parent
064169f0b6
commit
c944841dc6
2 changed files with 9 additions and 1 deletions
|
@ -45,6 +45,12 @@ the variables.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@defform[(NonemptyListof a)]{
|
||||||
|
|
||||||
|
A @racket[(Listof a)] which contains at least one element.
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@section{Type utilities}
|
@section{Type utilities}
|
||||||
|
|
||||||
Typed Racket's @racket[cast] should only be used as a last resort, because it
|
Typed Racket's @racket[cast] should only be used as a last resort, because it
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
(for-syntax syntax/parse racket/syntax racket/list))
|
(for-syntax syntax/parse racket/syntax racket/list))
|
||||||
|
|
||||||
(provide
|
(provide
|
||||||
Variable VariableMapping GeneralPair
|
Variable VariableMapping GeneralPair NonemptyListof
|
||||||
|
|
||||||
assert-type for/first/typed for*/first/typed define/abstract/error
|
assert-type for/first/typed for*/first/typed define/abstract/error
|
||||||
relax-arg-type/any
|
relax-arg-type/any
|
||||||
|
@ -28,6 +28,8 @@
|
||||||
(define-type Variable Symbol)
|
(define-type Variable Symbol)
|
||||||
(define-type (VariableMapping A) (Immutable-HashTable Variable A))
|
(define-type (VariableMapping A) (Immutable-HashTable Variable A))
|
||||||
|
|
||||||
|
(define-type (NonemptyListof a) (Pairof a (Listof a)))
|
||||||
|
|
||||||
(define-syntax-parse-rule (assert-type e:expr type:expr)
|
(define-syntax-parse-rule (assert-type e:expr type:expr)
|
||||||
(assert e (make-predicate type)))
|
(assert e (make-predicate type)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue