aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2018-11-16 00:04:06 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2018-11-16 00:04:06 +0100
commitd5692c4cf77ab4201f0eefcb4298f34475ca3463 (patch)
treec16dd33b6432d045ca657d397c375e225cb94849
parentAdd functor concept. (diff)
downloadscheme-monad-d5692c4cf77ab4201f0eefcb4298f34475ca3463.tar.gz
scheme-monad-d5692c4cf77ab4201f0eefcb4298f34475ca3463.tar.xz
Add curried map (cmap) to (data functor).
-rw-r--r--data/functor.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/data/functor.scm b/data/functor.scm
index 2286337..4e4722f 100644
--- a/data/functor.scm
+++ b/data/functor.scm
@@ -1,7 +1,8 @@
(define-module (data functor)
#:use-module (oop goops)
#:use-module (srfi srfi-1)
- #:export (fmap <$>))
+ #:use-module (ice-9 curried-definitions)
+ #:export (fmap <$> cmap))
;;; We don't overwrite the default map since that creates way to many
;;; namespace problems.
@@ -12,3 +13,7 @@
;;; Default fallback for fmap is regular (srfi-1) map.
(define-method (fmap f . lists)
(apply map f lists))
+
+;; Curried map
+(define ((cmap f) item)
+ (fmap f item))