From 5ba0ef3dc28c17a8873d5588b4ce8552a88abe8b Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 28 Jun 2021 19:39:21 +0530 Subject: ccwl: Return #f if alist is empty after filtering. This way, filter-alist composes better with other invocations of filter-alist. * ccwl/ccwl.scm (filter-alist): Return #f if alist is empty after filtering. (command->cwl): Remove FIXME note about the inputBinding dictionary being empty. --- ccwl/ccwl.scm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm index 9da805e..9c24a1b 100644 --- a/ccwl/ccwl.scm +++ b/ccwl/ccwl.scm @@ -72,11 +72,15 @@ (make-output id type binding source other)) (define (filter-alist alist) - "Filter ALIST removing entries with #f as the value." - (filter (match-lambda - ((_ . #f) #f) - (_ #t)) - alist)) + "Filter ALIST removing entries with #f as the value. If the +resulting association list is empty, return #f. Else, return that +association list." + (match (filter (match-lambda + ((_ . #f) #f) + (_ #t)) + alist) + (() #f) + (result result))) (define-immutable-record-type (make-step id run in out) @@ -245,7 +249,6 @@ (label . ,(input-label input)) (default . ,(and (not (unspecified-default? (input-default input))) (input-default input))) - ;; FIXME: inputBinding can be an empty dictionary. (inputBinding . ,(filter-alist `((position . ,(input-position input)) (prefix . ,(input-prefix input))))))) -- cgit v1.2.3