Fork me on GitHub
#meander
<
2021-07-21
>
pbaille05:07:40

Hello, i've stumble upon something weird this morning: (epsilon 626)

(defn bug [expr]
  (m/match expr
           (m/pred number?) {:num expr}
           (?verb & ?args) {:verb ?verb :args (map bug ?args)}
           _ {:any expr}))

(bug '(+ 1 (- 2 3)))
;; => {:any (+ 1 (- 2 3))}
any idea ?

pbaille05:07:27

here the expansion of the match form:

(let*
 [R__26068
  (clojure.core/let
   [T__26061 expr]
   (clojure.core/letfn
    [(state__26064 [] (if (number? T__26061) {:num expr} (state__26065)))
     (state__26065 [] {:any expr})
     (state__26066
      []
      (if
       (clojure.core/seq? T__26061)
       (clojure.core/let
        [T__26061_L__ (clojure.core/take 1 T__26061)]
        (if
         (clojure.core/= (clojure.core/bounded-count 2 T__26061_L__) 1)
         (clojure.core/let
          [T__26061_R__ (clojure.core/drop 1 T__26061)]
          (clojure.core/let
           [T__26061_L___nth_0__ (clojure.core/nth T__26061_L__ 0)]
           (clojure.core/let
            [?verb T__26061_L___nth_0__]
            (clojure.core/let [?args T__26061_R__] {:verb ?verb, :args (map bug ?args)}))))
         (state__26067)))
       (state__26067)))
     (state__26067 [] {:any expr})]
    (state__26064)))]
 (if
  (meander.match.runtime.epsilon/fail? R__26068)
  (throw (clojure.core/ex-info "non exhaustive pattern match" {}))
  R__26068))
the :any branch appears two times in the letfn bindings.

pbaille06:07:26

btw it seems ok with epsilon 602

noprompt16:07:11

Thanks for the report @pbaille. It seems like I broke a few things in 626. I’ll be working to fix these issues this week.

👍 4