Skip to content

Commit

Permalink
Add a transducer arity
Browse files Browse the repository at this point in the history
  • Loading branch information
athos committed Aug 28, 2023
1 parent c1b7716 commit 90c00f3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/cljam/io/vcf/util/validator.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)))

0 comments on commit 90c00f3

Please sign in to comment.