aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-04-20 02:15:16 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-04-20 02:15:16 +0200
commite80d0339a7ef9b029bded8fe86719f5d52b33ebf (patch)
tree0424c5867ff680df11e34d90f37e9473285a72cd
parentAdd some week handling procedures. (diff)
downloadcalp-e80d0339a7ef9b029bded8fe86719f5d52b33ebf.tar.gz
calp-e80d0339a7ef9b029bded8fe86719f5d52b33ebf.tar.xz
Add ->> macro.
-rw-r--r--module/util.scm11
1 files changed, 10 insertions, 1 deletions
diff --git a/module/util.scm b/module/util.scm
index dbbc1bf7..c7535310 100644
--- a/module/util.scm
+++ b/module/util.scm
@@ -12,7 +12,7 @@
quote?
re-export-modules
use-modules*
- -> set set-> aif awhen
+ -> ->> set set-> aif awhen
tree-map let-lazy let-env
case* define-many
and=>>
@@ -458,6 +458,15 @@
[(-> obj func rest ...)
(-> (func obj) rest ...)]))
+(define-syntax ->>
+ (syntax-rules ()
+ ((->> obj)
+ obj)
+ ((->> obj (func args ...) rest ...)
+ (->> (func args ... obj) rest ...))
+ ((->> obj func rest ...)
+ (->> (func obj) rest ...))))
+
;; Non-destructive set, syntax extension from set-fields from (srfi
;; srfi-9 gnu). Also doubles as a non-destructive mod!, if the `='
;; operator is used.