diff options
author | Arun Isaac | 2023-11-14 15:51:45 +0000 |
---|---|---|
committer | Arun Isaac | 2023-11-14 22:08:13 +0000 |
commit | 9af74fe933c7a58851547997dfaaa348d4c958f6 (patch) | |
tree | ef1f45afa82018d597f04b14a92793edccd0f3ea | |
parent | a6755fe41e3f3f09dd7b08adb3e63209e8a2ba0f (diff) | |
download | ccwl-9af74fe933c7a58851547997dfaaa348d4c958f6.tar.gz ccwl-9af74fe933c7a58851547997dfaaa348d4c958f6.tar.lz ccwl-9af74fe933c7a58851547997dfaaa348d4c958f6.zip |
ccwl: Build output from key outside of syntax.
It is easier (no need to juggle complex with-syntax constructs) to do
more complicated operations outside of the scope of syntax.
* ccwl/ccwl.scm (key->output): Build output from key outside of
syntax.
-rw-r--r-- | ccwl/ccwl.scm | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm index 2ece5d9..e174159 100644 --- a/ccwl/ccwl.scm +++ b/ccwl/ccwl.scm @@ -688,16 +688,31 @@ a <key> object, in STEPS, a list of <step> objects. If no such (eq? (step-id step) (key-step key))) steps))) - (with-syntax ((key-name (datum->syntax #f (key-name key))) - (key-cwl-id (datum->syntax #f (key-cwl-id key)))) - #`(set-output-id - (set-output-source (find (lambda (output) - (eq? (output-id output) - 'key-cwl-id)) - (function-outputs - #,(step-run step-with-output))) - #,(cwl-key-address key)) - 'key-name)))) + (let* ((output-for-key + ;; Find output object that corresponds to key. + (find (lambda (output) + (eq? (output-id output) + (key-cwl-id key))) + (function-outputs + (function-object + (step-run step-with-output))))) + (output + ;; Set output id and source fields from key. + (set-output-id + (set-output-source output-for-key + (cwl-key-address key)) + (key-name key)))) + ;; Construct syntax to recreate output object. + #`(make-output + #,(with-syntax ((id (datum->syntax #f (output-id output)))) + #''id) + #,(with-syntax ((type (datum->syntax #f (output-type output)))) + #''type) + #,(with-syntax ((binding (datum->syntax #f (output-binding output)))) + #''binding) + #,(output-source output) + #,(with-syntax ((other (datum->syntax #f (output-other output)))) + #''other))))) (define-syntax workflow (lambda (x) |