From 0df4c3586cd9f2000070278a80c0d7aad3b4fac8 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 16 Jan 2022 01:42:26 +0530 Subject: ccwl: Remove out field from type. The out field of a 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 and type definitions. (): Remove out field. Move to after function-objects. (step-out): New function. (collect-steps): Do not set out field of object. --- ccwl/ccwl.scm | 40 ++++++++++++++++++++-------------------- 1 file 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 +;;; Copyright © 2021, 2022 Arun Isaac ;;; ;;; 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 - (make-step id run in out) - step? - (id step-id) - (run step-run) - (in step-in) - (out step-out)) - (define-immutable-record-type (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 or +object." + ((cond + ((command? function) command-outputs) + ((cwl-workflow? function) cwl-workflow-outputs) + (else (error "Unrecognized ccwl function" function))) + function)) + +(define-immutable-record-type + (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 (make-workflow steps inputs outputs other) workflow? @@ -272,15 +282,6 @@ object or a object." (else (error "Unrecognized ccwl function" function))) function))) -(define (function-outputs function) - "Return the outputs of FUNCTION, a or -object." - ((cond - ((command? function) command-outputs) - ((cwl-workflow? function) cwl-workflow-outputs) - (else (error "Unrecognized ccwl function" function))) - function)) - (define-immutable-record-type (make-key name cwl-id step) key? @@ -412,8 +413,7 @@ represented by 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 ...) -- cgit v1.2.3