<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged gotcha</title>
<link>https://ask.clojure.org/index.php/tag/gotcha</link>
<description></description>
<item>
<title>Gotcha: core.match 'No matching clause' when using shadowed local binding</title>
<link>https://ask.clojure.org/index.php/14522/gotcha-match-matching-clause-using-shadowed-local-binding</link>
<description>&lt;p&gt;Here’s a repro:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  (defn wut [foo m]
    (match m
      [:m foo] :foo))

  (wut 1 [:m 2])
  ;; Execution error (IllegalArgumentException) at user/wut (REPL:560).
  ;; No matching clause: [:m 2]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The gotcha here is that I am using foo both as an argument and as a local match binding. This works:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  (defn wut [foo m]
    (match m
      [:m bar] :foo))
  
  (wut 1 [:m 2])
  ;;=&amp;gt; :foo
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I'm not sure if this is just what it is or if it is a problem that can be handled better by core.match? It def surprised me a lot and took a lot of time to figure out.&lt;/p&gt;
</description>
<category>Libs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14522/gotcha-match-matching-clause-using-shadowed-local-binding</guid>
<pubDate>Fri, 25 Apr 2025 12:40:12 +0000</pubDate>
</item>
</channel>
</rss>