From f10dfe8529cdba10f5a8cae1cb5b715cc8e9651a Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 6 Mar 2021 00:16:18 +0530 Subject: Migrate to SRFI-9 records. Functional setters from (srfi srfi-9 gnu) are very useful. * ccwl/ccwl.scm (, unspecified-default, , , , ): Redefine using SRFI-9 records. --- ccwl/ccwl.scm | 72 +++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm index afcb176..06191d1 100644 --- a/ccwl/ccwl.scm +++ b/ccwl/ccwl.scm @@ -4,8 +4,9 @@ ;; This file implements a generator to generate CWL files. (define-module (ccwl ccwl) - #:use-module (rnrs records syntactic) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-9) + #:use-module (srfi srfi-9 gnu) #:use-module (srfi srfi-71) #:use-module (ice-9 match) #:export (clitool @@ -17,33 +18,36 @@ intermediate clitool-step)) -(define-record-type ( make-input input?) - (fields (immutable id input-id) - (immutable type input-type) - (immutable default input-default) - (immutable label input-label) - (immutable other input-other))) -(define-record-type unspecified-default) +(define-immutable-record-type + (make-input id type label default binding source other) + input? + (id input-id) + (type input-type) + (default input-default) + (label input-label) + (other input-other)) + +(define-immutable-record-type + (make-unspecified-default) + unspecified-default?) (define* (input id #:key type label (default (make-unspecified-default)) (other '())) "Build and return an object." (make-input id type default label other)) -(define-record-type ( make-output output?) - (fields (immutable id output-id) - (immutable type output-type) - (immutable binding output-binding) - (immutable other output-other))) +(define-immutable-record-type + (make-output id type binding source other) + output? + (id output-id) + (type output-type) + (binding output-binding) + (other output-other)) (define* (output id #:key type binding (other '())) "Build and return an object." (make-output id type binding other)) -(define-record-type ( intermediate intermediate?) - (fields (immutable input intermediate-input) - (immutable output-source intermediate-output-source))) - (define* (clitool-step id args #:key (additional-inputs '()) (outputs '()) stdout stderr (other '())) (step id (clitool (map (lambda (arg) @@ -110,6 +114,12 @@ lists---the base command and the actual arguments." args))) (values base-command (parse-arguments arguments)))) +(define-immutable-record-type + (intermediate input output-source) + intermediate? + (input intermediate-input) + (output-source intermediate-output-source)) + (define (input->tree input) "Convert INPUT, an object, to a tree." @@ -161,23 +171,27 @@ lists---the base command and the actual arguments." `((stderr . ,stderr)) '())))) -(define-record-type ( make-workflow-output workflow-output?) - (fields (immutable id workflow-output-id) - (immutable type workflow-output-type) - (immutable source workflow-output-source) - (immutable other workflow-output-other))) - (define* (workflow-output id #:key type source (other '())) "Build and return a object." (make-workflow-output id type source other)) -(define-record-type ( step step?) - (fields (immutable id step-id) - (immutable run step-run) - (immutable in step-in) - (immutable out step-out))) - (define* (workflow steps outputs #:key (other '())) +(define-immutable-record-type + (make-workflow-output id type source other) + workflow-output? + (id workflow-output-id) + (type workflow-output-type) + (source workflow-output-source) + (other workflow-output-other)) + +(define-immutable-record-type + (make-step id run in out) + step? + (id step-id) + (run step-run set-step-run) + (in step-in set-step-in) + (out step-out set-step-out)) + "Build a Workflow class CWL workflow." `((cwlVersion . "v1.1") (class . Workflow) -- cgit v1.2.3