diff options
-rw-r--r-- | algebraic-structures.egg | 5 | ||||
-rw-r--r-- | algebraic-structures.private.string.scm | 6 | ||||
-rw-r--r-- | algebraic-structures.string.monoid.scm | 3 | ||||
-rw-r--r-- | algebraic-structures.string.semigroup.scm | 3 | ||||
-rw-r--r-- | tests/run.scm | 14 |
5 files changed, 31 insertions, 0 deletions
diff --git a/algebraic-structures.egg b/algebraic-structures.egg index 0cba2ef..44c9ffd 100644 --- a/algebraic-structures.egg +++ b/algebraic-structures.egg @@ -32,6 +32,11 @@ (extension algebraic-structures.number.sum.monoid) (extension algebraic-structures.number.sum.group) + ;; String + (extension algebraic-structures.private.string) + (extension algebraic-structures.string.semigroup) + (extension algebraic-structures.string.monoid) + ;; List (extension algebraic-structures.private.list) (extension algebraic-structures.list.semigroup) diff --git a/algebraic-structures.private.string.scm b/algebraic-structures.private.string.scm new file mode 100644 index 0000000..c6d17b6 --- /dev/null +++ b/algebraic-structures.private.string.scm @@ -0,0 +1,6 @@ +(module (algebraic-structures private string) (<> unit) + (import scheme) + + (define (<> x y) (string-append x y)) + + (define unit "")) diff --git a/algebraic-structures.string.monoid.scm b/algebraic-structures.string.monoid.scm new file mode 100644 index 0000000..cbd0bc2 --- /dev/null +++ b/algebraic-structures.string.monoid.scm @@ -0,0 +1,3 @@ +(import (algebraic-structures monoid) + (only (algebraic-structures private string))) +(module (algebraic-structures string monoid) = ((algebraic-structures monoid) (algebraic-structures private string))) diff --git a/algebraic-structures.string.semigroup.scm b/algebraic-structures.string.semigroup.scm new file mode 100644 index 0000000..8e8642f --- /dev/null +++ b/algebraic-structures.string.semigroup.scm @@ -0,0 +1,3 @@ +(import (algebraic-structures semigroup) + (only (algebraic-structures private string))) +(module (algebraic-structures string semigroup) = ((algebraic-structures semigroup) (algebraic-structures private string))) diff --git a/tests/run.scm b/tests/run.scm index adf0fc6..e9b7db2 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -41,6 +41,13 @@ (test-end "number.sum") +(test-begin "string") + +(import (prefix (algebraic-structures string semigroup) string:)) +(test "abc" (string:<> "ab" "c")) + +(test-end "string") + (test-begin "list") (import (prefix (algebraic-structures list semigroup) list:)) @@ -98,6 +105,13 @@ (test-end "number.sum") +(test-begin "string") + +(import (prefix (algebraic-structures string monoid) string:)) +(test "" (begin string:unit)) + +(test-end "string") + (test-begin "list") (import (prefix (algebraic-structures list monoid) list:)) |