| 1 |
;;; |
| 2 |
;;; SRFI-224 - Integer Mappings |
| 3 |
;;; |
| 4 |
;;; Copyright (c) 2021-2024 Shiro Kawai <[email protected]> |
| 5 |
;;; |
| 6 |
;;; Redistribution and use in source and binary forms, with or without |
| 7 |
;;; modification, are permitted provided that the following conditions |
| 8 |
;;; are met: |
| 9 |
;;; |
| 10 |
;;; 1. Redistributions of source code must retain the above copyright |
| 11 |
;;; notice, this list of conditions and the following disclaimer. |
| 12 |
;;; |
| 13 |
;;; 2. Redistributions in binary form must reproduce the above copyright |
| 14 |
;;; notice, this list of conditions and the following disclaimer in the |
| 15 |
;;; documentation and/or other materials provided with the distribution. |
| 16 |
;;; |
| 17 |
;;; 3. Neither the name of the authors nor the names of its contributors |
| 18 |
;;; may be used to endorse or promote products derived from this |
| 19 |
;;; software without specific prior written permission. |
| 20 |
;;; |
| 21 |
;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 22 |
;;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 23 |
;;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 24 |
;;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 25 |
;;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 26 |
;;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
| 27 |
;;; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 28 |
;;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 29 |
;;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 30 |
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 31 |
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 |
;;; |
| 33 |
|
| 34 |
(define-module srfi.224 |
| 35 |
(use data.sparse) |
| 36 |
(use util.match) |
| 37 |
(export |
| 38 |
;; Constructors |
| 39 |
fxmapping fxmapping-unfold fxmapping-accumulate |
| 40 |
alist->fxmapping alist->fxmapping/combinator |
| 41 |
|
| 42 |
;; Predicates |
| 43 |
fxmapping? fxmapping-contains? fxmapping-empty? fxmapping-disjoint? |
| 44 |
|
| 45 |
;; Accessors |
| 46 |
fxmapping-min fxmapping-max fxmapping-ref fxmapping-ref/default |
| 47 |
|
| 48 |
;; Updaters |
| 49 |
fxmapping-adjoin fxmapping-adjoin/combinator fxmapping-set |
| 50 |
fxmapping-adjust fxmapping-delete fxmapping-delete-all |
| 51 |
fxmapping-alter fxmapping-update |
| 52 |
fxmapping-delete-min fxmapping-delete-max |
| 53 |
fxmapping-update-min fxmapping-update-max |
| 54 |
fxmapping-pop-min fxmapping-pop-max |
| 55 |
|
| 56 |
;; The whole fxmapping |
| 57 |
fxmapping-size fxmapping-find fxmapping-count |
| 58 |
fxmapping-any? fxmapping-every? |
| 59 |
|
| 60 |
;; Traversal |
| 61 |
fxmapping-fold fxmapping-fold-right fxmapping-map fxmapping-map->list |
| 62 |
fxmapping-for-each fxmapping-relation-map |
| 63 |
|
| 64 |
;; Filter |
| 65 |
fxmapping-filter fxmapping-remove fxmapping-partition |
| 66 |
|
| 67 |
;; Copying and conversion |
| 68 |
fxmapping->alist fxmapping->decreasing-alist |
| 69 |
fxmapping-keys fxmapping-values |
| 70 |
fxmapping->generator fxmapping->decreasing-generator |
| 71 |
|
| 72 |
;; Comparison |
| 73 |
fxmapping=? fxmapping<? fxmapping>? fxmapping<=? fxmapping>=? |
| 74 |
|
| 75 |
;; Set theory operations |
| 76 |
fxmapping-union fxmapping-intersection fxmapping-difference fxmapping-xor |
| 77 |
fxmapping-union/combinator fxmapping-intersection/combinator |
| 78 |
|
| 79 |
;; Submappings |
| 80 |
fxmapping-open-interval fxmapping-closed-interval |
| 81 |
fxmapping-open-closed-interval fxmapping-closed-open-interval |
| 82 |
fxsubmapping= fxsubmapping< fxsubmapping<= fxsubmapping>= fxsubmapping> |
| 83 |
fxmapping-split |
| 84 |
)) |
| 85 |
(select-module srfi.224) |