From f8583f9a85f54d0a7b4902d0d23b1b83f387b593 Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Mon, 24 Jun 2024 00:06:23 +0900 Subject: Rename function from `<>` to `op` --- README.md | 6 +++--- algebraic-structures.group.scm | 8 ++++---- algebraic-structures.monoid.fold.scm | 8 ++++---- algebraic-structures.monoid.scm | 6 +++--- algebraic-structures.private.list.scm | 4 ++-- algebraic-structures.private.number.product.scm | 4 ++-- algebraic-structures.private.number.sum.scm | 4 ++-- algebraic-structures.private.stream.scm | 4 ++-- algebraic-structures.private.string.scm | 4 ++-- algebraic-structures.private.vector.scm | 4 ++-- algebraic-structures.semigroup.reduce.scm | 6 +++--- algebraic-structures.semigroup.scm | 4 ++-- examples/mod7.scm | 4 ++-- tests/run.scm | 20 ++++++++++---------- 14 files changed, 43 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 5998fac..90bf8c2 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ $ chicken-install (module (mod7 semigroup) = (algebraic-structures semigroup) (import scheme (chicken module)) - (export <>) + (export op) - (define (<> x y) + (define (op x y) (assert (integer? x)) (assert (integer? y)) (assert (not (zero? x))) @@ -73,7 +73,7 @@ $ chicken-install In REPL: ``` -> (map (cut mod7:pow 3 <>) '(0 1 2 3 4 5 6 7 8 9 10 11)) +> (map (cut mod7:pow 3 op) '(0 1 2 3 4 5 6 7 8 9 10 11)) (1 3 2 6 4 5 1 3 2 6 4 5) > (mod7:fold '(1 2 3 4 5 6)) 6 diff --git a/algebraic-structures.group.scm b/algebraic-structures.group.scm index 5cac19f..ab2ba7e 100644 --- a/algebraic-structures.group.scm +++ b/algebraic-structures.group.scm @@ -1,6 +1,6 @@ -(functor ((algebraic-structures group) (M (<> unit inv))) - (<> unit inv pow) - (import (only M <> unit inv) +(functor ((algebraic-structures group) (M (op unit inv))) + (op unit inv pow) + (import (only M op unit inv) scheme (chicken base)) @@ -13,4 +13,4 @@ (if (= i 0) acc (loop (sub1 i) - (<> acc x))))))) + (op acc x))))))) diff --git a/algebraic-structures.monoid.fold.scm b/algebraic-structures.monoid.fold.scm index 73fc64c..037251f 100644 --- a/algebraic-structures.monoid.fold.scm +++ b/algebraic-structures.monoid.fold.scm @@ -1,12 +1,12 @@ -(functor ((algebraic-structures monoid fold) (M (<> unit)) (F (fold))) (fold fold-map) +(functor ((algebraic-structures monoid fold) (M (op unit)) (F (fold))) (fold fold-map) (import (except scheme length) - (only M <> unit) + (only M op unit) (rename (only F fold) (fold foldable:fold))) - (define (fold x) (foldable:fold <> unit x)) + (define (fold x) (foldable:fold op unit x)) (define (fold-map f x) (foldable:fold (lambda (x acc) - (<> (f x) acc)) + (op (f x) acc)) unit x))) diff --git a/algebraic-structures.monoid.scm b/algebraic-structures.monoid.scm index dcd0e61..f5ee756 100644 --- a/algebraic-structures.monoid.scm +++ b/algebraic-structures.monoid.scm @@ -1,3 +1,3 @@ -(functor ((algebraic-structures monoid) (F (<> unit))) - (<> unit) - (import (only F <> unit))) +(functor ((algebraic-structures monoid) (F (op unit))) + (op unit) + (import (only F op unit))) diff --git a/algebraic-structures.private.list.scm b/algebraic-structures.private.list.scm index 4710b40..a5bb6f4 100644 --- a/algebraic-structures.private.list.scm +++ b/algebraic-structures.private.list.scm @@ -1,11 +1,11 @@ -(module (algebraic-structures private list) (<> unit fold reduce map1) +(module (algebraic-structures private list) (op unit fold reduce map1) (import scheme (rename (only (srfi 1) fold reduce) (fold srfi:fold) (reduce srfi:reduce)) (only (chicken base) assert)) - (define <> append) + (define op append) (define unit '()) diff --git a/algebraic-structures.private.number.product.scm b/algebraic-structures.private.number.product.scm index 0136b80..2b8e38e 100644 --- a/algebraic-structures.private.number.product.scm +++ b/algebraic-structures.private.number.product.scm @@ -1,7 +1,7 @@ -(module (algebraic-structures private number product) (<> unit inv) +(module (algebraic-structures private number product) (op unit inv) (import scheme) - (define (<> x y) (* x y)) + (define (op x y) (* x y)) (define unit 1) diff --git a/algebraic-structures.private.number.sum.scm b/algebraic-structures.private.number.sum.scm index c0db226..7931db3 100644 --- a/algebraic-structures.private.number.sum.scm +++ b/algebraic-structures.private.number.sum.scm @@ -1,7 +1,7 @@ -(module (algebraic-structures private number sum) (<> unit inv) +(module (algebraic-structures private number sum) (op unit inv) (import scheme) - (define (<> x y) (+ x y)) + (define (op x y) (+ x y)) (define unit 0) diff --git a/algebraic-structures.private.stream.scm b/algebraic-structures.private.stream.scm index a268841..b966a94 100644 --- a/algebraic-structures.private.stream.scm +++ b/algebraic-structures.private.stream.scm @@ -1,10 +1,10 @@ -(module (algebraic-structures private stream) (<> unit fold reduce map1) +(module (algebraic-structures private stream) (op unit fold reduce map1) (import scheme (srfi 41) (streams utils) (only (chicken base) assert)) - (define (<> xs ys) (stream-append xs ys)) + (define (op xs ys) (stream-append xs ys)) (define unit stream-null) diff --git a/algebraic-structures.private.string.scm b/algebraic-structures.private.string.scm index c6d17b6..dfe2e2d 100644 --- a/algebraic-structures.private.string.scm +++ b/algebraic-structures.private.string.scm @@ -1,6 +1,6 @@ -(module (algebraic-structures private string) (<> unit) +(module (algebraic-structures private string) (op unit) (import scheme) - (define (<> x y) (string-append x y)) + (define (op x y) (string-append x y)) (define unit "")) diff --git a/algebraic-structures.private.vector.scm b/algebraic-structures.private.vector.scm index c9deb22..7427001 100644 --- a/algebraic-structures.private.vector.scm +++ b/algebraic-structures.private.vector.scm @@ -1,10 +1,10 @@ -(module (algebraic-structures private vector) (<> unit fold reduce map1) +(module (algebraic-structures private vector) (op unit fold reduce map1) (import (except scheme vector-fill! vector->list list->vector) (only (chicken base) add1 assert) (srfi 133)) - (define (<> xs ys) (vector-append xs ys)) + (define (op xs ys) (vector-append xs ys)) (define unit #()) diff --git a/algebraic-structures.semigroup.reduce.scm b/algebraic-structures.semigroup.reduce.scm index 72fb831..c5e2996 100644 --- a/algebraic-structures.semigroup.reduce.scm +++ b/algebraic-structures.semigroup.reduce.scm @@ -1,6 +1,6 @@ -(functor ((algebraic-structures semigroup reduce) (S (<>)) (R (reduce))) (reduce) +(functor ((algebraic-structures semigroup reduce) (S (op)) (R (reduce))) (reduce) (import scheme - (only S <>) + (only S op) (rename (only R reduce) (reduce reducible:reduce))) - (define (reduce xs) (reducible:reduce <> xs))) + (define (reduce xs) (reducible:reduce op xs))) diff --git a/algebraic-structures.semigroup.scm b/algebraic-structures.semigroup.scm index 3c88f12..53d2069 100644 --- a/algebraic-structures.semigroup.scm +++ b/algebraic-structures.semigroup.scm @@ -1,2 +1,2 @@ -(functor ((algebraic-structures semigroup) (S (<>))) (<>) - (import (only S <>))) +(functor ((algebraic-structures semigroup) (S (op))) (op) + (import (only S op))) diff --git a/examples/mod7.scm b/examples/mod7.scm index 119c401..f21e975 100644 --- a/examples/mod7.scm +++ b/examples/mod7.scm @@ -8,9 +8,9 @@ (import scheme (chicken module) (only (chicken base) assert)) - (export <>) + (export op) - (define (<> x y) + (define (op x y) (assert (integer? x)) (assert (integer? y)) (assert (not (zero? x))) diff --git a/tests/run.scm b/tests/run.scm index 210584d..bbaca75 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -12,9 +12,9 @@ (import scheme (chicken module) (chicken base)) - (export <>) + (export op) - (define (<> x y) + (define (op x y) (assert (integer? x)) (assert (integer? y)) (assert (not (zero? x))) @@ -23,13 +23,13 @@ (import (prefix (mod7 semigroup) mod7:)) -(test 5 (mod7:<> 3 4)) +(test 5 (mod7:op 3 4)) (test-begin "number.product") (import (prefix (algebraic-structures number product semigroup) product:)) -(test 12 (product:<> 3 4)) +(test 12 (product:op 3 4)) (test-end "number.product") @@ -37,35 +37,35 @@ (import (prefix (algebraic-structures number sum semigroup) sum:)) -(test 7 (sum:<> 3 4)) +(test 7 (sum:op 3 4)) (test-end "number.sum") (test-begin "string") (import (prefix (algebraic-structures string semigroup) string:)) -(test "abc" (string:<> "ab" "c")) +(test "abc" (string:op "ab" "c")) (test-end "string") (test-begin "list") (import (prefix (algebraic-structures list semigroup) list:)) -(test '(a b c) (list:<> '(a b) '(c))) +(test '(a b c) (list:op '(a b) '(c))) (test-end "list") (test-begin "vector") (import (prefix (algebraic-structures vector semigroup) vector:)) -(test #(a b c) (vector:<> #(a b) #(c))) +(test #(a b c) (vector:op #(a b) #(c))) (test-end "vector") (test-begin "stream") (import (prefix (algebraic-structures stream semigroup) stream:)) -(test '(a b c) (stream->list (stream:<> (stream 'a 'b) (stream 'c)))) +(test '(a b c) (stream->list (stream:op (stream 'a 'b) (stream 'c)))) (test-end "stream") @@ -160,7 +160,7 @@ (import (prefix (mod7 group) mod7:)) (test (make-list 6 mod7:unit) - (map mod7:<> + (map mod7:op '(1 2 3 4 5 6) (map mod7:inv '(1 2 3 4 5 6)))) -- cgit v1.2.3