Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging recent changes. #11

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
*.import.scm
*.so
*.types
*.build.sh
*.install.sh
*.link
*.o
salmonella.log
Binary file modified comparators.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion comparators/comparators-impl.scm
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
(let ((elem=? (comparator-equality-predicate element-comparator)))
(let loop ((a a) (b b))
(cond
((and (empty? a) (empty? b) #t))
((and (empty? a) (empty? b)) #t)
((empty? a) #f)
((empty? b) #f)
((elem=? (head a) (head b)) (loop (tail a) (tail b)))
Expand Down
521 changes: 264 additions & 257 deletions comparators/comparators-test.scm

Large diffs are not rendered by default.

25 changes: 19 additions & 6 deletions comparators/comparators.scm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@

(module srfi-128 ()
(import scheme)
(import (only chicken use export include case-lambda error define-record-type
make-parameter parameterize : define-type))
(cond-expand
(chicken-5
(import (chicken base))
(import (chicken type))
(import (chicken module))
(import srfi-4)
;; FIXME: why is string-hash redefined?
(import (except srfi-13 string-hash)))
(else
(import (only chicken use export include case-lambda error define-record-type
make-parameter parameterize : define-type))
(use numbers)
(use srfi-4)
(use srfi-13)))

(export comparator? comparator-ordered? comparator-hashable?)
(export make-comparator
make-pair-comparator make-list-comparator make-vector-comparator
Expand All @@ -18,18 +31,18 @@
(export =? <? >? <=? >=?)
(export comparator-if<=>)
(export comparator-type-test-predicate comparator-equality-predicate
comparator-ordering-predicate comparator-hash-function)
(use numbers)
(use srfi-4)
(use srfi-13)
comparator-ordering-predicate comparator-hash-function)

(define-type :comparator: (struct comparator))
(define-type :type-test: (procedure (*) boolean))
(define-type :comparison-test: (procedure (* *) boolean))
(define-type :hash-code: fixnum)
(define-type :hash-function: (procedure (*) :hash-code:))

(include "comparators/r7rs-shim.scm")
(include "comparators/comparators-impl.scm")
(include "comparators/default.scm")

;; Chicken type declarations
(: comparator? (* --> boolean : :comparator:))
(: comparator-type-test-predicate (:comparator: --> :type-test:))
Expand Down
3 changes: 1 addition & 2 deletions comparators/default.scm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
bytevector? bytevector-length bytevector-u8-ref) obj))
; Add more here
(else (comparator-hash (registered-comparator (object-type obj)) obj))))

(define (default-ordering a b)
(let ((a-type (object-type a))
(b-type (object-type b)))
Expand All @@ -117,4 +117,3 @@
default-equality
default-ordering
default-hash))

13 changes: 6 additions & 7 deletions comparators/r7rs-shim.scm
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

(define exact inexact->exact)

; (define (exact-integer? x) (and (integer? x) (exact? x)))

(define bytevector? u8vector?)

(define bytevector-length u8vector-length)
Expand All @@ -36,8 +34,9 @@

(define string-foldcase string-downcase)

(define (infinite? x) (or (= x +inf.0) (= x -inf.0)))

(define (nan? x) (not (= x x)))

(define (exact-integer? obj) (and (integer? obj) (exact? obj)))
(cond-expand
(chicken-5)
(else
(define (infinite? x) (or (= x +inf.0) (= x -inf.0)))
(define (nan? x) (not (= x x)))
(define (exact-integer? obj) (and (integer? obj) (exact? obj)))))
16 changes: 16 additions & 0 deletions srfi-128.egg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
;; -*- Hen -*-

((synopsis "SRFI-128: Comparators (reduced)")
(version "0.9")
(license "BSD")
(category data)
(dependencies srfi-13)
(test-dependencies test)
(author "John Cowan")
(maintainer "Jeremy Steward, Jörg F. Wittenberger")
(synopsis "SRFI-128: Comparators (reduced)")
(components
(extension
srfi-128
(types-file)
(csc-options "-O3" "-d2"))))
2 changes: 2 additions & 0 deletions srfi-128.meta
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"comparators/r7rs-shim.scm"
"comparators/complex-shim.scm"
"tests/run.scm"
"srfi-128.egg"
"srfi-128.scm"
"srfi-128.setup"
"srfi-128.meta"
"srfi-128.release-info"
Expand Down
9 changes: 6 additions & 3 deletions srfi-128.release-info
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
(uri meta-file
"https://raw.githubusercontent.com/scheme-requests-for-implementation/{egg-name}/CHICKEN-{egg-release}/{egg-name}.meta")
"https://raw.githubusercontent.com/ThatGeoGuy/{egg-name}/CHICKEN-{egg-release}/{egg-name}.meta")
(release "0.9")
(release "0.8")
(release "0.7")
(release "0.6")
(release "0.5")
(release "0.4")
(release "0.3")

(repo git "git://github.com/scheme-requests-for-implementation/srfi-128.git")
(uri targz "https://codeload.github.com/scheme-requests-for-implementation/srfi-128/tar.gz/CHICKEN-{egg-release}" whole-repo)
(repo git "git://github.com/ThatGeoGuy/srfi-128.git")
(uri targz "https://codeload.github.com/ThatGeoGuy/srfi-128/tar.gz/CHICKEN-{egg-release}" whole-repo)
(release "0.1" whole-repo)
(release "0.2" whole-repo)
1 change: 1 addition & 0 deletions srfi-128.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(include "comparators/comparators.scm")
2 changes: 1 addition & 1 deletion srfi-128.setup
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
(install-extension
'srfi-128
`("srfi-128.types" ,(dynld-name "srfi-128") ,(dynld-name "srfi-128.import"))
'((version "0.6")))
'((version "0.9")))