Hi to anyone reading, I'm trying to understand a difference in behavior when using clojure.spec/conform on two different regex ops: + and *. They often conform the same when there is at least one item, but not always.
One small case I've found is: (s/def ::evens-or-odds (s/alt :evens (s/+ even?) :odds (s/+ odd?))) (defn conform-test [nums] (let [star (s/conform (s/* ::evens-or-odds) nums) plus (s/conform (s/+ ::evens-or-odds) nums)] [(= star plus) star plus])) (conform-test [1 2 3]) => [true [[:odds [1]] [:evens [2]] [:odds [3]]] [[:odds [1]] [:evens [2]] [:odds [3]]]] (conform-test [1 2 2]) => [false [[:odds [1]] [:evens [2 2]]] [[:odds [1]] [[:evens [2 2]]]]] (conform-test [1 2 2 3]) => [false [[:odds [1]] [:evens [2 2]] [:odds [3]]] [[:odds [1]] [[:evens [2 2]] [:odds [3]]]]] They conform the same for the first, but on the second and third, the + regex wraps all but the first group in a vector. I believe it has something to do with nested regex ops, but I haven't figured out the pattern. Same conform value: [1 2] [1 2 3] [1 1 2 3] Different conform values: [1 2 2] [1 2 2 3] [1 2 3 3] I appreciate your time and any insight or ideas about why these sets of cases conform differently. Thanks, Cole -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.