File: boundmap.rkt

package info (click to toggle)
racket 7.9%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 178,684 kB
  • sloc: ansic: 282,112; lisp: 234,887; pascal: 70,954; sh: 27,112; asm: 16,268; makefile: 4,613; cpp: 2,715; ada: 1,681; javascript: 1,244; cs: 879; exp: 499; csh: 422; python: 274; xml: 106; perl: 104
file content (64 lines) | stat: -rw-r--r-- 2,293 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
(module boundmap racket/base
  (require racket/contract/base
	   (for-syntax racket/base)
           "private/boundmap.rkt")
  
  (define-syntax provide/contract*
    (syntax-rules ()
      [(_ [(name0 name ...) contract])
       (begin (provide/contract [name0 contract])
              (provide/contract (rename name0 name contract)) ...)]
      [(_ [name contract])
       (provide/contract [name contract])]
      [(_ [name contract] ...)
       (begin (provide/contract* [name contract]) ...)]))

  (define-syntax (provide-mapping-code/contract stx)
    (syntax-case stx ()
      [(_ make-identifier-mapping
          identifier-mapping? identifier-mapping?/out
          identifier-mapping-get
          identifier-mapping-put!
          identifier-mapping-for-each
          identifier-mapping-map
          identifier=?)
       (syntax
	(provide/contract*
	 [make-identifier-mapping (-> identifier-mapping?)]
	 [identifier-mapping?/out (any/c . -> . boolean?)]
         [identifier-mapping-get (->* (identifier-mapping?
                                       identifier?)
                                      ((-> any))
                                      any)]
	 [identifier-mapping-put! (identifier-mapping?
				   identifier?
				   any/c
				   . -> .
				   void?)]
	 [identifier-mapping-for-each (identifier-mapping?
				       (identifier? any/c . -> . any)
				       . -> .
				       void?)]
	 [identifier-mapping-map (identifier-mapping?
				  (identifier? any/c . -> . any)
				  . -> .
				  (listof any/c))]))]))

  (provide-mapping-code/contract
   make-bound-identifier-mapping
   bound-identifier-mapping? bound-identifier-mapping?
   bound-identifier-mapping-get
   bound-identifier-mapping-put!
   bound-identifier-mapping-for-each
   bound-identifier-mapping-map
   bound-identifier=?)
  
  (provide-mapping-code/contract
   [make-module-identifier-mapping make-free-identifier-mapping]
   module-identifier-mapping?
   [module-identifier-mapping? free-identifier-mapping?]
   [module-identifier-mapping-get free-identifier-mapping-get]
   [module-identifier-mapping-put! free-identifier-mapping-put!]
   [module-identifier-mapping-for-each free-identifier-mapping-for-each]
   [module-identifier-mapping-map free-identifier-mapping-map]
   module-identifier=?))