diff options
author | Arun Isaac | 2024-09-11 15:57:21 +0100 |
---|---|---|
committer | Arun Isaac | 2024-09-11 15:57:21 +0100 |
commit | 5ef416199d69090219261b367a74b9e374579ef8 (patch) | |
tree | c365764ffa0d4ce2375dd582627598e326922bd6 | |
parent | d40495f231e2a6ca233329d8d9558d1d13a9599f (diff) | |
download | ravanan-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.scm | 16 |
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") |