summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2021-03-06 02:01:14 +0530
committerArun Isaac2021-03-06 02:12:04 +0530
commite4405073d482f64c82ff41f40b09503dcc5948d6 (patch)
treea64985a234abcba15bd18a3e2019a88681b38b0f
parent3df1beff308d8b0fdbc6a32cf17dc5908d39fcb8 (diff)
downloadccwl-e4405073d482f64c82ff41f40b09503dcc5948d6.tar.gz
ccwl-e4405073d482f64c82ff41f40b09503dcc5948d6.tar.lz
ccwl-e4405073d482f64c82ff41f40b09503dcc5948d6.zip
Add field appenders.
* ccwl/ccwl.scm (field-appender, append-step-in, append-step-out, append-command-inputs, append-command-outputs): New functions.
-rw-r--r--ccwl/ccwl.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm
index e73b9e6..0eed492 100644
--- a/ccwl/ccwl.scm
+++ b/ccwl/ccwl.scm
@@ -127,6 +127,16 @@
(in step-in set-step-in)
(out step-out set-step-out))
+(define (field-appender getter setter)
+ (lambda (object element)
+ (setter object (cons element (getter object)))))
+
+(define append-step-in
+ (field-appender step-in set-step-in))
+
+(define append-step-out
+ (field-appender step-out set-step-out))
+
(define-immutable-record-type <command>
(make-command inputs outputs args stdin other)
command?
@@ -136,6 +146,12 @@
(stdin command-stdin set-command-stdin)
(other command-other))
+(define append-command-inputs
+ (field-appender command-inputs set-command-inputs))
+
+(define append-command-outputs
+ (field-appender command-outputs set-command-outputs))
+
(define* (command id arguments #:key (additional-inputs '()) (outputs '()) (other '()))
(make-step id
(make-command (append (filter input? arguments)