aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2024-09-11 15:57:21 +0100
committerArun Isaac2024-09-11 15:57:21 +0100
commit5ef416199d69090219261b367a74b9e374579ef8 (patch)
treec365764ffa0d4ce2375dd582627598e326922bd6
parentd40495f231e2a6ca233329d8d9558d1d13a9599f (diff)
downloadravanan-5ef416199d69090219261b367a74b9e374579ef8.tar.gz
ravanan-5ef416199d69090219261b367a74b9e374579ef8.tar.lz
ravanan-5ef416199d69090219261b367a74b9e374579ef8.zip
workflow: Move optional input predicate to separate function.
* ravanan/workflow.scm (optional-input?): New function. (command-line-tool->propagator): Use optional-input?.
-rw-r--r--ravanan/workflow.scm16
1 files changed, 10 insertions, 6 deletions
diff --git a/ravanan/workflow.scm b/ravanan/workflow.scm
index 0e52a73..87458e0 100644
--- a/ravanan/workflow.scm
+++ b/ravanan/workflow.scm
@@ -123,6 +123,15 @@ requirements and hints of the step."
(else (error "Unable to coerce value to type" val type))))
(else val)))
+(define (optional-input? input)
+ "Return @code{#t} if @var{input} is optional. Else, return @code{#f}."
+ ;; Inputs that either have a default or accept null values are optional.
+ (and (or (assoc-ref input "default")
+ (match-type 'null
+ (formal-parameter-type
+ (assoc-ref* input "type"))))
+ (assoc-ref input "id")))
+
(define* (command-line-tool->propagator name cwl)
"Convert @code{CommandLineTool} workflow @var{cwl} of @var{name} to a
propagator."
@@ -134,12 +143,7 @@ propagator."
(assoc-ref cwl "inputs"))
;; Inputs that either have a default or accept null values are
;; optional.
- (vector-filter-map->list (lambda (input)
- (and (or (assoc-ref input "default")
- (match-type 'null
- (formal-parameter-type
- (assoc-ref* input "type"))))
- (assoc-ref input "id")))
+ (vector-filter-map->list optional-input?
(assoc-ref cwl "inputs"))
(vector-map->list (lambda (output)
(cons (assoc-ref output "id")