When using the n or more operator to match a pattern in a vec with a preceding any (_) operator; the n-or-more operator will match empty lists in m/search. This behavior is different from from m/match, which will not match on empty lists.
Code snippet for reproducing:
(comment
(require '[meander.epsilon :as m])
(m/match
[]
[_ ..2] :matched-two-or-more
_ :didnt-mach)
;; => :didnt-mach ;; this is expected, there are no items in the input vec
(m/search
[]
[_ ..2] :matched-two-or-more)
;; => (:matched-two-or-more) ;; the vec is empty, so this should be nil, but the expression returns :matched-two-or-more
)
When using the n or more operator to match a pattern in a vec with a preceding
any
(_
) operator; the n-or-more operator will match empty lists inm/search
. This behavior is different from fromm/match
, which will not match on empty lists.Code snippet for reproducing:
See brief discussion in clojurians slack for a bit more context.