aboutsummaryrefslogtreecommitdiff
path: root/ccwl
diff options
context:
space:
mode:
authorArun Isaac2022-01-16 01:42:26 +0530
committerArun Isaac2022-01-16 12:25:16 +0530
commit0df4c3586cd9f2000070278a80c0d7aad3b4fac8 (patch)
tree97bcce2c01e3197cb485ef0c28f6128b1bbaa63f /ccwl
parent58421411541c99011c59c7f81bf3763bc1f75dd0 (diff)
downloadccwl-0df4c3586cd9f2000070278a80c0d7aad3b4fac8.tar.gz
ccwl-0df4c3586cd9f2000070278a80c0d7aad3b4fac8.tar.lz
ccwl-0df4c3586cd9f2000070278a80c0d7aad3b4fac8.zip
ccwl: Remove out field from <step> type.
The out field of a <step> object can be derived from its run field. There is no need to store it. Therefore, we remove the out field and implement the accessor step-out as a separate function so that we don't break existing code. We also move around some code so that all variables are defined before they are used. * ccwl/ccwl.scm (function-objects): Move to just after <command> and <cwl-workflow> type definitions. (<step>): Remove out field. Move to after function-objects. (step-out): New function. (collect-steps): Do not set out field of <step> object.
Diffstat (limited to 'ccwl')
-rw-r--r--ccwl/ccwl.scm40
1 files changed, 20 insertions, 20 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm
index 8faf97e..b6a2920 100644
--- a/ccwl/ccwl.scm
+++ b/ccwl/ccwl.scm
@@ -1,5 +1,5 @@
;;; ccwl --- Concise Common Workflow Language
-;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2021, 2022 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of ccwl.
;;;
@@ -121,14 +121,6 @@
(id (identifier? #'id) (output #'(id)))
(_ (error "Invalid output:" (syntax->datum output-spec)))))
-(define-immutable-record-type <step>
- (make-step id run in out)
- step?
- (id step-id)
- (run step-run)
- (in step-in)
- (out step-out))
-
(define-immutable-record-type <command>
(make-command inputs outputs args stdin other)
command?
@@ -145,6 +137,24 @@
(inputs cwl-workflow-inputs)
(outputs cwl-workflow-outputs))
+(define (function-outputs function)
+ "Return the outputs of FUNCTION, a <command> or <cwl-workflow>
+object."
+ ((cond
+ ((command? function) command-outputs)
+ ((cwl-workflow? function) cwl-workflow-outputs)
+ (else (error "Unrecognized ccwl function" function)))
+ function))
+
+(define-immutable-record-type <step>
+ (make-step id run in)
+ step?
+ (id step-id)
+ (run step-run)
+ (in step-in))
+
+(define step-out (compose function-outputs step-run))
+
(define-immutable-record-type <workflow>
(make-workflow steps inputs outputs other)
workflow?
@@ -272,15 +282,6 @@ object or a <cwl-workflow> object."
(else (error "Unrecognized ccwl function" function)))
function)))
-(define (function-outputs function)
- "Return the outputs of FUNCTION, a <command> or <cwl-workflow>
-object."
- ((cond
- ((command? function) command-outputs)
- ((cwl-workflow? function) cwl-workflow-outputs)
- (else (error "Unrecognized ccwl function" function)))
- function))
-
(define-immutable-record-type <key>
(make-key name cwl-id step)
key?
@@ -412,8 +413,7 @@ represented by <step> objects."
(find (lambda (key)
(eq? value (key-name key)))
input-keys)))))
- (pairify (syntax->datum #'(args ...))))
- (function-outputs function-object))))))
+ (pairify (syntax->datum #'(args ...)))))))))
;; ccwl functions with an implicit step identifier
((function args ...)
(collect-steps #'(function (function) args ...)