aboutsummaryrefslogtreecommitdiff
path: root/ccwl/ccwl.scm
diff options
context:
space:
mode:
authorArun Isaac2023-09-29 13:58:50 +0100
committerArun Isaac2023-09-29 13:58:50 +0100
commit900ecf10e030393653592b4200d2582b15158454 (patch)
tree97ae846ebf9ced2920e45a0b3cd413d4611603e2 /ccwl/ccwl.scm
parentd58e5585b62bd284a7e27045e748c2cf1d31a649 (diff)
downloadccwl-900ecf10e030393653592b4200d2582b15158454.tar.gz
ccwl-900ecf10e030393653592b4200d2582b15158454.tar.lz
ccwl-900ecf10e030393653592b4200d2582b15158454.zip
ccwl: Allow steps with unspecified default arguments.
* ccwl/ccwl.scm (function-inputs): New function. (function-input-keys): Use function-inputs. (collect-steps): Do not error out on steps with unspecified default arguments. * tests/ccwl.scm (print-with-default): New variable. ("allow steps with unspecified default arguments"): New test.
Diffstat (limited to 'ccwl/ccwl.scm')
-rw-r--r--ccwl/ccwl.scm20
1 files changed, 14 insertions, 6 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm
index f380485..174b040 100644
--- a/ccwl/ccwl.scm
+++ b/ccwl/ccwl.scm
@@ -372,15 +372,20 @@ RUN-ARGS. If such an input is not present in RUN-ARGS, return #f."
(eq? (input-id input1)
(input-id input2)))
+(define (function-inputs function)
+ "Return the list of inputs accepted by @var{function}, a
+@code{<command>} or @code{<cwl-workflow>} object."
+ ((cond
+ ((command? function) command-inputs)
+ ((cwl-workflow? function) cwl-workflow-inputs)
+ (else (error "Unrecognized ccwl function" function)))
+ function))
+
(define (function-input-keys function)
"Return the list of input keys accepted by FUNCTION, a <command>
object or a <cwl-workflow> object."
(map input-id
- ((cond
- ((command? function) command-inputs)
- ((cwl-workflow? function) cwl-workflow-inputs)
- (else (error "Unrecognized ccwl function" function)))
- function)))
+ (function-inputs function)))
(define-immutable-record-type <key>
(make-key name cwl-id step)
@@ -474,7 +479,10 @@ represented by <step> objects."
;; TODO: Filter out optional parameters.
(match (lset-difference
eq?
- (function-input-keys function-object)
+ (filter-map (lambda (input)
+ (and (unspecified-default? (input-default input))
+ (input-id input)))
+ (function-inputs function-object))
(map (match-lambda
((key . _) (keyword->symbol key)))
(syntax->datum (pairify #'(args ...)))))