From 6c7ab94299b0996d2dbba5305f4e4f81d2405738 Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Thu, 13 Jun 2024 23:51:03 +0900 Subject: Rename procedures `map` to `map1` and `map*` to `map` --- algebraic-structures.applicative.scm | 8 ++++---- algebraic-structures.functor.scm | 4 ++-- tests/run.scm | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/algebraic-structures.applicative.scm b/algebraic-structures.applicative.scm index ac3028a..489f76d 100644 --- a/algebraic-structures.applicative.scm +++ b/algebraic-structures.applicative.scm @@ -1,5 +1,5 @@ -(functor ((algebraic-structures applicative) (A (pure map map2))) - (pure map map2 map* apply) +(functor ((algebraic-structures applicative) (A (pure map1 map2))) + (pure map1 map2 map apply) (import (rename scheme (map scheme:map) (apply scheme:apply)) (only (chicken base) sub1 add1 foldl case-lambda) A @@ -16,9 +16,9 @@ (lambda (args) (k (cons x args)))))))) - (define map* + (define map (case-lambda - ((f x) (map f x)) + ((f x) (map1 f x)) ((f x y) (map2 f x y)) ((f x . xs) (let ((g (curry-n f (add1 (length xs))))) diff --git a/algebraic-structures.functor.scm b/algebraic-structures.functor.scm index 70d5496..c1a5639 100644 --- a/algebraic-structures.functor.scm +++ b/algebraic-structures.functor.scm @@ -1,3 +1,3 @@ -(functor ((algebraic-structures functor) (F (map))) - (map) +(functor ((algebraic-structures functor) (F (map1))) + (map1) (import F)) diff --git a/tests/run.scm b/tests/run.scm index 0d76cda..b49db8e 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -126,12 +126,12 @@ (import (algebraic-structures functor)) (module (data list functor) = (algebraic-structures functor) - (import scheme (chicken module)) - (export map)) + (import (chicken module)) + (reexport (rename scheme (map map1)))) (import (prefix (data list functor) list:)) -(test '((a) (b) (c)) (list:map list '(a b c))) +(test '((a) (b) (c)) (list:map1 list '(a b c))) (test-end "functor") @@ -179,7 +179,7 @@ (list:map2 list '(a b c) '(1 2))) (test '((a 1 z) (a 2 z) (b 1 z) (b 2 z) (c 1 z) (c 2 z)) - (list:map* list '(a b c) '(1 2) '(z))) + (list:map list '(a b c) '(1 2) '(z))) (test-end "applicative") @@ -187,7 +187,7 @@ (import (algebraic-structures monad)) (module (data list monad) = (algebraic-structures monad) - (import (except scheme map) + (import scheme (chicken module) (srfi 1)) (reexport (data list applicative)) -- cgit v1.2.3