From d5692c4cf77ab4201f0eefcb4298f34475ca3463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 16 Nov 2018 00:04:06 +0100 Subject: Add curried map (cmap) to (data functor). --- data/functor.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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)) -- cgit v1.2.3