source: project/release/5/check-errors/trunk/type-errors-numbers.impl.scm @ 35789

Last change on this file since 35789 was 35789, checked in by kon, 13 months ago

canonical

File size: 1.9 KB
Line 
1;;;; type-errors-numbers.impl.scm  -*- Scheme -*-
2;;;; Kon Lovett, Jul '18
3
4(import scheme
5  (only (chicken string) conc)
6  type-errors-basic
7  type-errors-numbers)
8
9;;;
10
11(define-error-type fixnum)
12(define-error-type positive-fixnum)
13(define-error-type natural-fixnum)
14(define-error-type negative-fixnum)
15(define-error-type non-positive-fixnum)
16(define-error-type flonum)
17(define-error-type number)
18(define-error-type positive-number)
19(define-error-type natural-number)
20(define-error-type negative-number)
21(define-error-type non-positive-number)
22(define-error-type integer)
23(define-error-type positive-integer)
24(define-error-type natural-integer)
25(define-error-type negative-integer)
26(define-error-type non-positive-integer)
27(define-error-type real)
28(define-error-type complex)
29(define-error-type rational)
30(define-error-type exact)
31(define-error-type inexact)
32
33(define (error-range loc start end #!optional argnam)
34  (signal-bounds-error
35    loc
36    (make-bad-argument-message argnam)
37    start end) )
38
39(define (error-interval loc num lft min max rgt #!optional argnam)
40  (signal-bounds-error
41    loc
42    (conc (make-bad-argument-message argnam) " must be in " lft min " " max rgt)
43    num) )
44
45(define +left-open-interval+ '|(|)     ;'|]|
46(define +right-open-interval+ '|)|)    ;'|[|
47
48(define +left-closed-interval+ '|[|)
49(define +right-closed-interval+ '|]|)
50
51(define (error-closed-interval loc num min max #!optional argnam)
52  (error-interval loc num +left-closed-interval+ min max +right-closed-interval+ argnam))
53
54(define (error-open-interval loc num min max #!optional argnam)
55  (error-interval loc num +left-open-interval+ min max +right-open-interval+ argnam))
56
57(define (error-half-open-interval loc num min max #!optional argnam)
58  (error-interval loc num +left-open-interval+ min max +right-closed-interval+ argnam))
59
60(define (error-half-closed-interval loc num min max #!optional argnam)
61  (error-interval loc num +left-closed-interval+ min max +right-open-interval+ argnam))
Note: See TracBrowser for help on using the repository browser.