From 90c00f31ccd53ecd3634138b63ce91fc4a5413e3 Mon Sep 17 00:00:00 2001 From: Shogo Ohta Date: Mon, 28 Aug 2023 20:50:20 +0900 Subject: [PATCH] Add a transducer arity --- src/cljam/io/vcf/util/validator.clj | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/cljam/io/vcf/util/validator.clj b/src/cljam/io/vcf/util/validator.clj index ee98a5d1..5a8c7eb7 100644 --- a/src/cljam/io/vcf/util/validator.clj +++ b/src/cljam/io/vcf/util/validator.clj @@ -280,9 +280,12 @@ (defn validate-variants "Applies `validation-variant` to each element of the given sequence and collects - non-nil validation results into a lazy sequence." - [validator variants] - (keep (partial validate-variant validator) variants)) + non-nil validation results into a lazy sequence. + Returns a transducer if `variants` is not specified." + ([validator] + (keep (partial validate-variant validator))) + ([validator variants] + (sequence (validate-variants validator) variants))) (defn- stringify-validation-result-messages [m] (with-out-str @@ -323,6 +326,9 @@ "Applies `check-variant` to each element of the given sequence. Returns a lazy sequence of the same elements of the input if there are no invalid variant. The validation is evaluated lazily and throws an exception - at the first invalid variant." - [validator variants] - (map (partial check-variant validator) variants)) + at the first invalid variant. + Returns a transducer if `variants` is not specified." + ([validator] + (map (partial check-variant validator))) + ([validator variants] + (sequence (check-variants validator) variants)))