aboutsummaryrefslogtreecommitdiff
path: root/ccwl
diff options
context:
space:
mode:
authorArun Isaac2023-12-01 22:41:17 +0000
committerArun Isaac2023-12-01 22:54:33 +0000
commitd63f2df9d10ab425930900283323aba4b96b8a8c (patch)
tree0ddef6c50b0ae1ba77bb465674b83599dc842ba1 /ccwl
parentd5fadbd7d93fe047a37591a149bae007c359b88c (diff)
downloadccwl-d63f2df9d10ab425930900283323aba4b96b8a8c.tar.gz
ccwl-d63f2df9d10ab425930900283323aba4b96b8a8c.tar.lz
ccwl-d63f2df9d10ab425930900283323aba4b96b8a8c.zip
ccwl: Deduplicate global workflow input keys across tee branches.
* ccwl/ccwl.scm (collect-steps): Deduplicate global workflow input keys across branches of tees. * tests/ccwl.scm (key, collect-steps): New variables. ("rename should work even on the final output of a workflow"): Update order of elements in expected list. ("tee must deduplicate global workflow input keys"): New test. * ccwl/utils.scm (append-mapn): Delete function. * tests/utils.scm ("append-mapn"): Delete test.
Diffstat (limited to 'ccwl')
-rw-r--r--ccwl/ccwl.scm11
-rw-r--r--ccwl/utils.scm19
2 files changed, 9 insertions, 21 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm
index bbc5de1..743944d 100644
--- a/ccwl/ccwl.scm
+++ b/ccwl/ccwl.scm
@@ -636,8 +636,15 @@ represented by <step> objects."
(list)))
;; tee
((tee expressions ...)
- (append-mapn (cut collect-steps <> input-keys)
- #'(expressions ...)))
+ (let ((key-lists step-lists (mapn (cut collect-steps <> input-keys)
+ #'(expressions ...))))
+ (values
+ ;; Global workflow input keys may be duplicated across the
+ ;; branches of a tee. So, deduplicate them by treating key
+ ;; lists as sets. TODO: Error out if any keys other than
+ ;; global workflow inputs are duplicated.
+ (apply lset-union eq? key-lists)
+ (apply append step-lists))))
((identity)
(values input-keys (list)))
;; rename keys (base case)
diff --git a/ccwl/utils.scm b/ccwl/utils.scm
index d9d1ee3..3c18efd 100644
--- a/ccwl/utils.scm
+++ b/ccwl/utils.scm
@@ -39,7 +39,6 @@
lambda**
syntax-lambda**
mapn
- append-mapn
foldn
filter-mapi))
@@ -329,24 +328,6 @@ number of lists are returned. For example,
(call-with-values (cut proc x) list))
lst))))
-(define (append-mapn proc lst)
- "Map PROC over LST just as in mapn, but append the results
-together. PROC can return multiple values, in which case, an equal
-number of lists are returned.
-
-(append-mapn (lambda (n)
- (values (list n (expt n 2))
- (list n (expt n 3))))
- (iota 5))
-=> (0 0 1 1 2 4 3 9 4 16)
-=> (0 0 1 1 2 8 3 27 4 64)"
- (call-with-values (cut mapn proc lst)
- (lambda lists
- (apply values
- (map (lambda (lst)
- (apply append lst))
- lists)))))
-
(define (foldn proc lst . inits)
"Apply PROC to the elements of LST to build a result, and return
that result. PROC can return multiple values, in which case, an equal