srfi-128.sld 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. ;;; Copyright (C) John Cowan (2015). All Rights Reserved.
  2. ;;;
  3. ;;; Permission is hereby granted, free of charge, to any person
  4. ;;; obtaining a copy of this software and associated documentation
  5. ;;; files (the "Software"), to deal in the Software without
  6. ;;; restriction, including without limitation the rights to use,
  7. ;;; copy, modify, merge, publish, distribute, sublicense, and/or
  8. ;;; sell copies of the Software, and to permit persons to whom the
  9. ;;; Software is furnished to do so, subject to the following
  10. ;;; conditions:
  11. ;;;
  12. ;;; The above copyright notice and this permission notice shall be
  13. ;;; included in all copies or substantial portions of the Software.
  14. ;;;
  15. ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. ;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  17. ;;; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18. ;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  19. ;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  20. ;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  21. ;;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22. ;;; OTHER DEALINGS IN THE SOFTWARE.
  23. (define-library (srfi srfi-128)
  24. (export comparator? comparator-ordered? comparator-hashable?
  25. make-comparator
  26. make-pair-comparator make-list-comparator make-vector-comparator
  27. make-eq-comparator make-eqv-comparator make-equal-comparator
  28. boolean-hash char-hash char-ci-hash
  29. string-hash string-ci-hash symbol-hash number-hash
  30. make-default-comparator default-hash comparator-register-default!
  31. comparator-type-test-predicate comparator-equality-predicate
  32. comparator-ordering-predicate comparator-hash-function
  33. comparator-test-type comparator-check-type comparator-hash
  34. hash-bound hash-salt
  35. =? <? >? <=? >=?
  36. comparator-if<=>
  37. )
  38. (import (scheme base)
  39. (scheme case-lambda)
  40. (scheme char)
  41. (scheme inexact)
  42. (scheme complex))
  43. (cond-expand ((library (srfi srfi-126))
  44. (import (only (srfi srfi-126) equal-hash)))
  45. ((library (rnrs hashtables))
  46. (import (only (rnrs hashtables) equal-hash)))
  47. ((library (r6rs hashtables))
  48. (import (only (r6rs hashtables) equal-hash)))
  49. ((library (srfi srfi-69))
  50. (import (rename (only (srfi srfi-69) hash-by-identity)
  51. (hash-by-identity equal-hash))))
  52. (else
  53. ;; FIXME: This works well enough for the test program,
  54. ;; but you wouldn't want to use it in a real program.
  55. (begin (define (equal-hash x) 0))))
  56. (include "srfi-128/128.body1.scm")
  57. (include "srfi-128/128.body2.scm")
  58. )