<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions in core.match</title>
<link>https://ask.clojure.org/index.php/questions/contrib-libs/core-match</link>
<description></description>
<item>
<title>Allow `core.match` patterns to contain fully qualified class names</title>
<link>https://ask.clojure.org/index.php/12564/allow-core-match-patterns-contain-fully-qualified-class-names</link>
<description>&lt;p&gt;When matching on Class objects in &lt;code&gt;core.match&lt;/code&gt;, the symbol normally used to name the Class object is treated by default as a pattern wildcard, just like any other symbol. The &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.match/wiki/Basic-usage#locals&quot;&gt;basic usage documentation&lt;/a&gt; shows this behavior and suggests local rebinding to get the intended behavior.&lt;/p&gt;
&lt;p&gt;Rebinding is an adequate solution, but I find that, when writing or reading code, it is easy to overlook a missing binding. Another solution might be to use a fully-qualified class name:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(match [(type 1)]
  [java.lang.String] :string
  [java.lang.Long] :long
  :else :no-match)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By adopting this convention, developers wouldn't need to look at any scope larger than the pattern itself to know whether the class names will resolve correctly, making it easier to spot bugs when reading the code (and likely also making it easier to lint for this).&lt;/p&gt;
&lt;p&gt;However, this syntax is not currently supported:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Syntax error (ClassFormatError) compiling fn* at (REPL:1:1).
Illegal field name &quot;java.lang.String&quot; in class user$eval1591
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Symbols with no namespace which contain one or more periods are in the general case &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/reader#_symbols&quot;&gt;documented&lt;/a&gt; as indicating class names, and they do not work in local bindings (hence the error), so supporting this syntax shouldn't conflict with any other possible meanings of the symbol.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12564/allow-core-match-patterns-contain-fully-qualified-class-names</guid>
<pubDate>Tue, 17 Jan 2023 15:12:12 +0000</pubDate>
</item>
<item>
<title>core.match: syntax error during macro expansion when string key contains a slash character</title>
<link>https://ask.clojure.org/index.php/11729/match-syntax-error-during-expansion-string-contains-character</link>
<description>&lt;p&gt;When passed a map with a string key containing a slash character, &lt;code&gt;clojure.core.match/match&lt;/code&gt; errors during macro expansion.&lt;/p&gt;
&lt;p&gt;This happens in both Clojure and Clojurescript. &lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clj -Sdeps '{:deps {org.clojure/core.match {:mvn/version &quot;1.0.0&quot;}}}'

Clojure 1.10.3
user=&amp;gt; (require '[clojure.core.match :as match])
nil

user=&amp;gt; (match/match {} {&quot;a/b&quot; x} x)
Syntax error macroexpanding clojure.core/let at (REPL:1:1).
ocr-1539_a/b__1543 - failed: simple-symbol? at: [:bindings :form :local-symbol] spec: :clojure.core.specs.alpha/local-name

user=&amp;gt; (match/match {&quot;a/b&quot; 0} {&quot;a/b&quot; x} x)
Syntax error macroexpanding clojure.core/let at (REPL:1:1).
ocr-1545_a/b__1549 - failed: simple-symbol? at: [:bindings :form :local-symbol] spec: :clojure.core.specs.alpha/local-name
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Expected behavior: it should be possible to match on all strings, even if they contain special characters.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11729/match-syntax-error-during-expansion-string-contains-character</guid>
<pubDate>Mon, 04 Apr 2022 19:11:31 +0000</pubDate>
</item>
<item>
<title>Bug when matching on a vector with a map clause that uses `:only`</title>
<link>https://ask.clojure.org/index.php/11284/bug-when-matching-on-a-vector-with-a-map-clause-that-uses-only</link>
<description>&lt;p&gt;There seems to be a bug where a clause uses the &lt;code&gt;:only&lt;/code&gt; qualifier to ensure that a map has a specific set of keys. If the value being matched is a vector a &lt;code&gt;ClassCastException&lt;/code&gt; exception is thrown.&lt;/p&gt;
&lt;p&gt;Here is an example that works as expected and does not use &lt;code&gt;:only&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [x []]
  (match [x]
    [{:k v}] :a-map
    :else :not-a-map))
=&amp;gt; :not-a-map
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If we teak it slightly to add the &lt;code&gt;:only&lt;/code&gt; an unexpected error is thrown.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [x []]
  (match [x]
    [({:k v} :only [:k])] :a-map
    :else :not-a-map))
;; Execution error (ClassCastException) at ...
;; clojure.lang.PersistentVector cannot be cast to java.util.Map
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Slack user @FiVo identified that the form produced for map patterns will perform the map checks on any value that is an &lt;code&gt;ILookup&lt;/code&gt;, but the checks may will include a call to &lt;code&gt;.keySet&lt;/code&gt; if the &lt;code&gt;:only&lt;/code&gt; qualifier is used.&lt;/p&gt;
&lt;p&gt;It was suggested that the references to &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.match/blob/master/src/main/clojure/clojure/core/match.clj#L1217-L1219&quot;&gt;ILookup here&lt;/a&gt; be changed to &lt;code&gt;IPersistentMap&lt;/code&gt;. CLJ tests still pass with this change. &lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11284/bug-when-matching-on-a-vector-with-a-map-clause-that-uses-only</guid>
<pubDate>Fri, 19 Nov 2021 05:32:39 +0000</pubDate>
</item>
<item>
<title>How do I contribute to the README for core.match?</title>
<link>https://ask.clojure.org/index.php/10205/how-do-i-contribute-to-the-readme-for-core-match</link>
<description>&lt;p&gt;I would like to add some information to the README for core.match.  However, a simple PR on the README seems to be against the procedure.&lt;/p&gt;
&lt;p&gt;How do I contribute?  I already have a signed CA.&lt;/p&gt;
&lt;p&gt;Also, JIRA appears to be down (tried that first).&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10205/how-do-i-contribute-to-the-readme-for-core-match</guid>
<pubDate>Thu, 18 Feb 2021 05:35:52 +0000</pubDate>
</item>
<item>
<title>Can core.match LiteralPattern emit more specialized code?</title>
<link>https://ask.clojure.org/index.php/9909/can-core-match-literalpattern-emit-more-specialized-code</link>
<description>&lt;p&gt;Hello,&lt;br&gt;
Looking at the code emitted by core.match, I see that literals are always compared using &lt;code&gt;=&lt;/code&gt;. &lt;br&gt;
While it works, wouldn't it be faster to specialize equality for different literals, such as:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; (number? l) `(and (number? ~ocr) (== ~l ~ocr))
 (keyword? l) `(identical? ~l ~ocr)
 (nil? l) `(nil? ~ocr)
 (true? l) `(true? ~ocr)
 (false? l) `(false? ~ocr)
 (string? l) `(.equals ~l ~ocr)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(snippet added to &lt;code&gt;LiteralPattern&lt;/code&gt; cond.&lt;/p&gt;
&lt;p&gt;Crude benchmarks show it's faster than &lt;code&gt;=&lt;/code&gt; and all the tests pass, too.&lt;/p&gt;
&lt;p&gt;Think this warrants a patch?&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9909/can-core-match-literalpattern-emit-more-specialized-code</guid>
<pubDate>Tue, 01 Dec 2020 07:29:48 +0000</pubDate>
</item>
<item>
<title>Shadowing bindings does not work as expected</title>
<link>https://ask.clojure.org/index.php/7456/shadowing-bindings-does-not-work-as-expected</link>
<description>&lt;p&gt;This is a bug with core.match, or (far less likely) with the macro expansion in Clojure.&lt;/p&gt;
&lt;p&gt;This code:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(let (link: foo [:bar :baz)]&lt;br&gt;
  (match foo&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(link: :bar boo) boo
:else :got-else))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;returns &lt;code&gt;:baz&lt;/code&gt;. While this code:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(let (link: foo [:bar :baz)]&lt;br&gt;
  (match foo&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(link: :bar foo) foo
:else :got-else))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;returns &lt;code&gt;:got-else&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;They should be equal, since the &lt;code&gt;foo&lt;/code&gt; in the match should shadow the &lt;code&gt;foo&lt;/code&gt; in&lt;br&gt;
the let. In fact, when running &lt;code&gt;macroexpand-1&lt;/code&gt; on these forms, they only differ in&lt;br&gt;
the gensym numbers and the letter &lt;code&gt;f&lt;/code&gt; vs &lt;code&gt;b&lt;/code&gt; in &lt;code&gt;foo&lt;/code&gt; and &lt;code&gt;bar&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I have created a repo that reproduces the bug:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/magnars/bug-examples/tree/core-match-shadow-bindings&quot;&gt;https://github.com/magnars/bug-examples/tree/core-match-shadow-bindings&lt;/a&gt;&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7456/shadowing-bindings-does-not-work-as-expected</guid>
<pubDate>Fri, 12 Jan 2018 11:05:54 +0000</pubDate>
</item>
<item>
<title>Keyword literal as function apply(:&lt;&lt;) result</title>
<link>https://ask.clojure.org/index.php/7476/keyword-literal-as-function-apply-result</link>
<description>Fails:&lt;br /&gt;
&lt;br /&gt;
(let [x [:k1 :k2 :k3]]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;(m/match [x]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[(:k1 :&amp;lt;&amp;lt; first)] :first))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Invalid list syntax :&amp;lt;&amp;lt; in (:k1 :&amp;lt;&amp;lt; first). Valid syntax:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;[[:default :guard] [:or :default] [:default :only] [:default :seq]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;[:default :when] [:default :as] [:default :&amp;lt;&amp;lt;] [:default&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;:clojure.core.match/vector]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Work:&lt;br /&gt;
&lt;br /&gt;
(let [k1 :k1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x [:k1 :k2 :k3]]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;(m/match [x]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[(k1 :&amp;lt;&amp;lt; first)] :first))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Is it a bug or a feature?&lt;br /&gt;
How to match keywords correctly?</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7476/keyword-literal-as-function-apply-result</guid>
<pubDate>Mon, 16 Oct 2017 09:55:14 +0000</pubDate>
</item>
<item>
<title>Exception when regexp-matching on a map key that does not exist.</title>
<link>https://ask.clojure.org/index.php/7478/exception-when-regexp-matching-on-map-key-that-does-not-exist</link>
<description>When matching map values via regular expressions with a key that does not exist in the map, {{core.match}} throws an exception. Here is an example:&lt;br /&gt;
&lt;br /&gt;
{code:none} &lt;br /&gt;
(= 2 (match {:foo &amp;quot;bar&amp;quot;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{:bar #&amp;quot;bar&amp;quot;} 1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:else 2))))&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
throws &lt;br /&gt;
&lt;br /&gt;
{code:none} &lt;br /&gt;
java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.CharSequence&lt;br /&gt;
&amp;nbsp;at clojure.core$re_matcher.invoke (core.clj:4460)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;clojure.core$re_matches.invoke (core.clj:4497)&lt;br /&gt;
...&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
because {{re-match}} gets called with the {{:clojure.core.match/not-found}} keyword since the key was not found.&lt;br /&gt;
&lt;br /&gt;
The attached patch contains a test case for the problem and offers a fix by making sure that {{re-match}} only gets called when the key was found and fails the match gently otherwise.</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7478/exception-when-regexp-matching-on-map-key-that-does-not-exist</guid>
<pubDate>Mon, 08 May 2017 07:16:03 +0000</pubDate>
</item>
<item>
<title>Or matches with vectors improperly match</title>
<link>https://ask.clojure.org/index.php/7483/or-matches-with-vectors-improperly-match</link>
<description>&lt;p&gt;Someone on reddit reported a problem they were having with core.match and or patterns. I looked into and after checking the macro expansion, there seemed to be a bug in core.match. I was able to fix the bug. I will attach the patch shortly.&lt;/p&gt;
&lt;p&gt;This is my first time submitting a patch this way, so if I left anything off please let me know.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.reddit.com/r/Clojure/comments/697l1i/is_this_a_clojurecorematch_bug_or_its_just_me/&quot;&gt;https://www.reddit.com/r/Clojure/comments/697l1i/is_this_a_clojurecorematch_bug_or_its_just_me/&lt;/a&gt;&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7483/or-matches-with-vectors-improperly-match</guid>
<pubDate>Fri, 05 May 2017 00:35:15 +0000</pubDate>
</item>
<item>
<title>Empty seq match can throw Exception</title>
<link>https://ask.clojure.org/index.php/7479/empty-seq-match-can-throw-exception</link>
<description>For example:&lt;br /&gt;
&lt;br /&gt;
user=&amp;gt; (let [x 5] (m/match x ([] :seq) true :else false))&lt;br /&gt;
IllegalArgumentException Don't know how to create ISeq from: java.lang.Long &amp;nbsp;clojure.lang.RT.seqFrom (RT.java:542)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The problem appears to be that empty seq patterns are converted to LiteralPatterns for (). IPatternCompile for LiteralPatterns checks if the literal is () -- if so it emits an {{empty?}} test without any check to see if the ocr is {{Seqable}}.</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7479/empty-seq-match-can-throw-exception</guid>
<pubDate>Sat, 01 Apr 2017 18:53:26 +0000</pubDate>
</item>
<item>
<title>Fix typo on multimethod</title>
<link>https://ask.clojure.org/index.php/7482/fix-typo-on-multimethod</link>
<description>&lt;p&gt;Fix typo on multimethod&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7482/fix-typo-on-multimethod</guid>
<pubDate>Fri, 10 Mar 2017 22:06:44 +0000</pubDate>
</item>
<item>
<title>Simplify computation of necessary column</title>
<link>https://ask.clojure.org/index.php/7477/simplify-computation-of-necessary-column</link>
<description>&lt;p&gt;From match.clj:&lt;br&gt;
;; IMPORTANT NOTE: this calculation is very very slow,&lt;br&gt;
;; we should look at this more closely - David&lt;/p&gt;
&lt;p&gt;This has to do with computing the necessary column, ie, the column that contains the most number of matches we will have to do. This patch simplifies this logic which is spread out over several functions and puts it into one location. Further, it improves complexity. When computing the necessity of a column, only patters above wildcards in a column need to be computed. the way the previous implementation worked was to compute the value for each entry in the pattern matrix and then check above each entry to see if there were wildcards. Now, we just group by column and then reduce on the column, adding up the same values as last time and immediately returning the accumulator with &lt;code&gt;(reduced acc)&lt;/code&gt; if we hit a wildcard. This saves the repeated traversal of each column for each entry. A nice benefit is locality of everything inside of a single function.&lt;/p&gt;
&lt;p&gt;I've timed this against master with the entries from &lt;code&gt;bench.clj&lt;/code&gt; and was actually a little surprised to see that there was no time speedup, however.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7477/simplify-computation-of-necessary-column</guid>
<pubDate>Wed, 07 Dec 2016 02:56:14 +0000</pubDate>
</item>
<item>
<title>Outdated dependencies</title>
<link>https://ask.clojure.org/index.php/7449/outdated-dependencies</link>
<description>&lt;p&gt;The Clojure version specified in core is 1.6, which is lower than the minimum supported version in CIDER (1.7)&lt;br&gt;
The Clojurescript version is &quot;0.0-2496&quot; which seems rather outdated compared to the current &quot;1.9.293&quot;&lt;br&gt;
The lein-cljsbuild is &quot;1.0.4-snapshot&quot; instead of current 1.1.4&lt;/p&gt;
&lt;p&gt;Rather critically, this specifies its own version of cider-nrepl, a very out of date 0.8.1, rather than letting CIDER inject its current version (stable 0.14 or dev 0.15). These happen automatically now depending upon the version of CIDER you are running.&lt;/p&gt;
&lt;p&gt;this just updates these versions in the project.clj file.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7449/outdated-dependencies</guid>
<pubDate>Fri, 02 Dec 2016 18:23:04 +0000</pubDate>
</item>
<item>
<title>core.match clojurescript should be self-host compatible</title>
<link>https://ask.clojure.org/index.php/7474/core-match-clojurescript-should-be-self-host-compatible</link>
<description>&lt;p&gt;core.match clojurescript should be self-host compatible&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7474/core-match-clojurescript-should-be-self-host-compatible</guid>
<pubDate>Sun, 23 Oct 2016 15:17:58 +0000</pubDate>
</item>
<item>
<title>AppPattern with single wildcard throws exception</title>
<link>https://ask.clojure.org/index.php/7475/apppattern-with-single-wildcard-throws-exception</link>
<description>&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;user=&amp;gt; (require '[clojure.core.match :as m])
nil
user=&amp;gt; (m/match [[1 2 3]] [(x :&amp;lt;&amp;lt; first)] x)
IllegalArgumentException No method in multimethod 'to-source' for dispatch value: null  clojure.lang.MultiFn.getFn (MultiFn.java:156)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;It seems this can be fixed by adding a dummy to-source for wildcards:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
user=&amp;gt; (defmethod m/to-source nil [pattern ocr]&lt;br&gt;
  (if (m/wildcard-pattern? pattern)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;true
(throw (AssertionError. (str &quot;Don't know how to emit code for: &quot; pattern)))))
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;object[clojure.lang.MultiFn 0x4bb9f7d4 &quot;clojure.lang.MultiFn@4bb9f7d4&quot;]&lt;/h2&gt;
&lt;p&gt;user=&amp;gt; (m/match [[1 2 3]] [(x :&amp;lt;&amp;lt; first)] x)&amp;lt;br&amp;gt;
1&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7475/apppattern-with-single-wildcard-throws-exception</guid>
<pubDate>Fri, 29 Jul 2016 17:22:11 +0000</pubDate>
</item>
<item>
<title>Rather simple match fails with code too large</title>
<link>https://ask.clojure.org/index.php/7473/rather-simple-match-fails-with-code-too-large</link>
<description>&lt;p&gt;The following function fails to compile. If I change the row     &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(link: :context _ _)   formula
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(link: :context _)   formula
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;it works.&lt;/p&gt;
&lt;p&gt;(defn terms (link: formula)&lt;br&gt;
  (match formula&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(link: :root r)      (recur r)
(link: :expr e)      (recur e)
(link: :call f [:args &amp;amp; args]] (for [arg args) (terms arg))
(link: :refer _ _)   formula
(link: :float _)     formula
(link: :context _ _)   formula
(link: :string _)    formula
(link: :eq e1 _ e2)  (concat (terms e1) (terms e2))
(link: :add &amp;amp; args ) (for (link: arg args) (terms arg))
(link: :sub &amp;amp; args ) (for (link: arg args) (terms arg))
(link: :div &amp;amp; args ) (for (link: arg args) (terms arg))
(link: :mul &amp;amp; args ) (for (link: arg args) (terms arg))

))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7473/rather-simple-match-fails-with-code-too-large</guid>
<pubDate>Sat, 02 Jul 2016 22:03:52 +0000</pubDate>
</item>
<item>
<title>Typo in match.clj</title>
<link>https://ask.clojure.org/index.php/7468/typo-in-match-clj</link>
<description>&lt;p&gt;Line 1710 of match.clj (0.3.0-alpha4) has this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(defmethod groupable? [::predice ::predicate]
  [a b] (= (:gs a) (:gs b)))&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I believe &quot;predice&quot; should be &quot;predicate&quot;.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7468/typo-in-match-clj</guid>
<pubDate>Wed, 15 Jun 2016 18:31:26 +0000</pubDate>
</item>
<item>
<title>:as and &amp; interaction issue</title>
<link>https://ask.clojure.org/index.php/7466/as-and-interaction-issue</link>
<description>&lt;p&gt;Unless i'm mistaken, it looks like there is some interaction problem between &amp;amp; patterns and :as patterns&lt;/p&gt;
&lt;p&gt;(match (link: [:bar :baz)]&lt;br&gt;
  (link: ([:bar &amp;amp; r) :as m)] m)&lt;br&gt;
-&amp;gt; (link: :bar)&lt;/p&gt;
&lt;p&gt;I'm expecting (link: :bar :baz) here&lt;/p&gt;
&lt;p&gt;This is as I expect :&lt;br&gt;
(match (link: [:bar :baz)]&lt;br&gt;
  (link: [:bar &amp;amp; r)] :a)&lt;br&gt;
-&amp;gt; :a&lt;/p&gt;
&lt;p&gt;This is also as expected :&lt;br&gt;
(match (link: [:bar :baz)]&lt;br&gt;
  (link: ([:bar :baz) :as m)] m)&lt;br&gt;
-&amp;gt; (link: :bar :baz)&lt;/p&gt;
&lt;p&gt;so &amp;amp; and :as each work on its own.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7466/as-and-interaction-issue</guid>
<pubDate>Fri, 18 Sep 2015 18:01:39 +0000</pubDate>
</item>
<item>
<title>convert to .cljc</title>
<link>https://ask.clojure.org/index.php/7467/convert-to-cljc</link>
<description></description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7467/convert-to-cljc</guid>
<pubDate>Wed, 05 Aug 2015 20:17:18 +0000</pubDate>
</item>
<item>
<title>Upgrade org.clojure/tools.analyzer.jvm dependency to &quot;0.6.6&quot;</title>
<link>https://ask.clojure.org/index.php/7469/upgrade-org-clojure-tools-analyzer-jvm-dependency-to-0-6-6</link>
<description>&lt;p&gt;Currently core.match depends on tools.analyzer.jvm &quot;0.6.5&quot;, the latest release is &quot;0.6.6&quot;. The outdated dependency on tools.analyzer.jvm conflicts with core.async's dependency on version &quot;0.6.6&quot;. This can cause unexpected behavior when a project depends on both core.match and core.async.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7469/upgrade-org-clojure-tools-analyzer-jvm-dependency-to-0-6-6</guid>
<pubDate>Wed, 20 May 2015 20:32:47 +0000</pubDate>
</item>
<item>
<title>Map pattern with vector key raises &quot;clojure.lang.PersistentVector cannot be cast to clojure.lang.Named&quot; exception</title>
<link>https://ask.clojure.org/index.php/7487/pattern-vector-clojure-persistentvector-clojure-exception</link>
<description>&lt;p&gt;The following pattern throws &quot;CompilerException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Named&quot;:&lt;/p&gt;
&lt;p&gt;(let (link: x {[1) 2}]&lt;br&gt;
  (match (link: x)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;     (link: {[1] _}) true))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7487/pattern-vector-clojure-persistentvector-clojure-exception</guid>
<pubDate>Wed, 29 Apr 2015 03:07:16 +0000</pubDate>
</item>
<item>
<title>variable binding fails with :or guard</title>
<link>https://ask.clojure.org/index.php/7465/variable-binding-fails-with-or-guard</link>
<description>&lt;p&gt;The following works&lt;br&gt;
 fine:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(match (link: 'F) (link: ('F :as x)) x)
;; =&amp;gt; F&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;But fails when I try to use an :or guard:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(match (link: 'F) (link: ((:or 'F 'T) :as x)) x)
;; CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context&lt;/code&gt;&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7465/variable-binding-fails-with-or-guard</guid>
<pubDate>Tue, 07 Apr 2015 20:08:15 +0000</pubDate>
</item>
<item>
<title>Regex: only attempt to match string values.</title>
<link>https://ask.clojure.org/index.php/7453/regex-only-attempt-to-match-string-values</link>
<description>&lt;p&gt;Before this fix, matching a regex pattern against a non-string value would crash like so:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.CharSequence&lt;br&gt;
 at clojure.core$re_matcher.invoke (core.clj:4460)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clojure.core$re_matches.invoke (core.clj:4497)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;...&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7453/regex-only-attempt-to-match-string-values</guid>
<pubDate>Sat, 07 Mar 2015 05:52:37 +0000</pubDate>
</item>
<item>
<title>Support for lists in patterns.</title>
<link>https://ask.clojure.org/index.php/7480/support-for-lists-in-patterns</link>
<description>&lt;p&gt;Currently it is not possible to use list literals with or without variables in a pattern.&lt;br&gt;
Thus something like this&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(match ['(1 2 3)]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;   ['(a b c)] a)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;will result in a failing assert.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;AssertionError Invalid list syntax (a b c) in (quote (a b c)).&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;There is a workaround for this by using &lt;code&gt;:seq&lt;/code&gt; and &lt;code&gt;:guard&lt;/code&gt;, as in&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(match ['(1 2 3)]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;   [(([a b c] :seq) :guard list?)] a)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;but it is rather tedious to write.&lt;/p&gt;
&lt;p&gt;List matching would be very useful when writing macros and compilers.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7480/support-for-lists-in-patterns</guid>
<pubDate>Thu, 18 Dec 2014 16:19:48 +0000</pubDate>
</item>
<item>
<title>Do :guard predicates really need to handle :clojure.core.match/not-found?</title>
<link>https://ask.clojure.org/index.php/7470/guard-predicates-really-need-handle-clojure-core-match-found</link>
<description>I'm very new to {{core.match}} and just started playing around. &amp;nbsp;Doing so, I came up with this example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(for [x [[1 2 3]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;[1 2 3 4]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;{:a 17, :b 2}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;{:a 23, :b 7}]]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;(match [x]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;[[a b c]] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[a b c]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;[{:a a, :b 2}] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{:a a}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;[{:a (a :guard odd?), :b b}] {:a a, :b b}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;:else &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:no-match))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This errors with the message ??&amp;quot;IllegalArgumentException Argument must be an integer: :clojure.core.match/not-found clojure.core/even? core.clj:1351)&amp;quot;??. &amp;nbsp;The problem is that the keyword {{:clojure.core.match/not-found}} is passed to the {{:guard}} function {{odd?}} which passes it to {{even?}}.&lt;br /&gt;
&lt;br /&gt;
I can fix it by ensuring the my guard only gets an integer like so:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(for [x [[1 2]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[1 2 3]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[1 2 3 4]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{:a 17, :b 2}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{:a 23, :b 7}]]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;(match [x]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;[[a b c]] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[a b c]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;[{:a a, :b 2}] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{:a a}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;[{:a (a :guard #(and (integer? %)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(odd? %))), :b b}] {:a a, :b b}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;:else &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:no-match))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But is it really intensional that guards have to deal with {{:clojure.core.match/not-found?}} &amp;nbsp;In my opinion, in the example above all maps that are matched have integer values, so it seems plausible that I can have a guard that only accepts integers.</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7470/guard-predicates-really-need-handle-clojure-core-match-found</guid>
<pubDate>Wed, 17 Dec 2014 11:44:23 +0000</pubDate>
</item>
<item>
<title>Apparent regression for test sharing literals</title>
<link>https://ask.clojure.org/index.php/7484/apparent-regression-for-test-sharing-literals</link>
<description>&lt;p&gt;Not sure when this one was introduced but literal tests appear to not share correctly and literals are needlessly retested.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7484/apparent-regression-for-test-sharing-literals</guid>
<pubDate>Fri, 12 Dec 2014 22:17:20 +0000</pubDate>
</item>
<item>
<title>Example in Overview Wiki Page Results in an Exception</title>
<link>https://ask.clojure.org/index.php/7460/example-in-overview-wiki-page-results-in-an-exception</link>
<description>&lt;p&gt;The first example for &quot;Or Patterns&quot; on the Overview page in the wiki will cause an IllegalArgumentException.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
user=&amp;gt; (use '[clojure.core.match :only (match)])&lt;br&gt;
nil&lt;br&gt;
user=&amp;gt; (let [x '(1 2 3)]&lt;br&gt;
  #&lt;em&gt;=&amp;gt;   (match [x]&lt;br&gt;
  #&lt;/em&gt;=&amp;gt;     [[1 (:or 3 4) 3]] :a0&lt;br&gt;
  #_=&amp;gt;     [[1 (:or 2 3) 3]] :a1))&lt;/p&gt;
&lt;p&gt;IllegalArgumentException No matching clause: (1 2 3)  user/eval5476 (form-init4056337243047274400.clj:2)&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The example should probably either use a vector for x, or a seq pattern in the match. Included patch with the latter.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7460/example-in-overview-wiki-page-results-in-an-exception</guid>
<pubDate>Wed, 03 Dec 2014 00:15:12 +0000</pubDate>
</item>
<item>
<title>recur detection logic is too naive</title>
<link>https://ask.clojure.org/index.php/7464/recur-detection-logic-is-too-naive</link>
<description>&lt;p&gt;The following explodes because of the presence of {{recur}}:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(defn rec [expr]&lt;br&gt;
  (match expr&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;     [:global] 'GLOBAL
     [:constant x] x
     [:variable x] x
     [:lazy-variable x] `(deref ~x)
     [:if test if-true if-false] `(if ~(rec test)
                                    ~(rec if-true)
                                    ~(rec if-false))
     [:delist list index] `(get ~(rec list) ~(rec index))
     [:depair pair key] `(get ~(rec pair) ~(match key :first 0 :second 1))
     [:list elements] (map rec elements)
     [:fold-recur index-arg list-sym] `(recur (+ 1 ~index-arg) (rest ~list-sym))
     [:zip left right] `(map vector ~(rec left) ~(rec right))
     [:filter list arg body] `(filter (fn [~arg] ~(rec body) ~(rec list)))
     [:len list] `(count ~(rec list))
     [:pair first second] [(rec first) (rec second)]
     [:block arg body] `(fn [~arg] ~(rec body))
     [:app f arg] `(~(rec f) ~(rec arg))
     [:query e annotations] `(QUERY ~(rec e) ~annotations)
     [:lookup key] `(LOOKUP ~key)
     [:let name value expr] `(let [~name ~value] expr)
     ; ... about 15 more
     ))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7464/recur-detection-logic-is-too-naive</guid>
<pubDate>Wed, 16 Apr 2014 20:30:50 +0000</pubDate>
</item>
<item>
<title>Simple capturing of :or matches with :as doesn't work</title>
<link>https://ask.clojure.org/index.php/7472/simple-capturing-of-or-matches-with-as-doesnt-work</link>
<description>&lt;p&gt;All three of these expressions should work (according to @dnolen in IRC):&lt;/p&gt;
&lt;p&gt;&lt;code&gt;user&amp;gt; (match/match [5] [((:or 5 6) :as x)] x)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context
user&amp;gt; (match/match [5] [(:or (5 :as x) (6 :as x))] x)
5
user&amp;gt; (match/match [5] [(:or (5 :as x) (6 :as y))] x)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;(The first makes sense to me, but the latter two don't; e.g. should {{y}} be {{nil}} in the last example, or something else?)&lt;/p&gt;
&lt;p&gt;Though it's not necessary, it'd be nice if the following &quot;sugared&quot; form worked, too:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;user&amp;gt; (match/match [5] [(:or 5 6 :as x)] x)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context&lt;/code&gt;&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7472/simple-capturing-of-or-matches-with-as-doesnt-work</guid>
<pubDate>Thu, 30 Jan 2014 15:53:30 +0000</pubDate>
</item>
<item>
<title>ignore duplicate wildcard check if matching a local multiple times in same pattern row</title>
<link>https://ask.clojure.org/index.php/7485/ignore-duplicate-wildcard-check-matching-multiple-pattern</link>
<description>&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(let [v 10]&lt;br&gt;
  (match x&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[v v v] ...))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7485/ignore-duplicate-wildcard-check-matching-multiple-pattern</guid>
<pubDate>Tue, 19 Nov 2013 21:45:12 +0000</pubDate>
</item>
<item>
<title>Tidy up for 0.2.0, add comprehensive doc strings</title>
<link>https://ask.clojure.org/index.php/7486/tidy-up-for-0-2-0-add-comprehensive-doc-strings</link>
<description>&lt;p&gt;Tidy up for 0.2.0, add comprehensive doc strings&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7486/tidy-up-for-0-2-0-add-comprehensive-doc-strings</guid>
<pubDate>Tue, 25 Jun 2013 18:12:32 +0000</pubDate>
</item>
<item>
<title>Switches on literals should happen via `case` not `cond`</title>
<link>https://ask.clojure.org/index.php/7451/switches-on-literals-should-happen-via-case-not-cond</link>
<description>&lt;p&gt;It worth investigating whether this improves performance at all.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7451/switches-on-literals-should-happen-via-case-not-cond</guid>
<pubDate>Tue, 25 Jun 2013 18:11:31 +0000</pubDate>
</item>
<item>
<title>rest patterns don't work on arrays</title>
<link>https://ask.clojure.org/index.php/7463/rest-patterns-dont-work-on-arrays</link>
<description>&lt;p&gt;Currently they simply don't work. When we make it work we should probably wrap the array in something like ArraySeq. We might want to consider support for unwrapping ArraySeq. We need to carry type information as well as offset information.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7463/rest-patterns-dont-work-on-arrays</guid>
<pubDate>Thu, 20 Jun 2013 23:52:47 +0000</pubDate>
</item>
<item>
<title>pass occurrence to emit-pattern</title>
<link>https://ask.clojure.org/index.php/7462/pass-occurrence-to-emit-pattern</link>
<description>&lt;p&gt;Currently we have a hack to read type information at vector pattern specialization time overriding whatever the :t field is for a VectorPattern instance. We should instead pass the occurrence to emit-pattern so the vector-pattern can start with the correct type information.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7462/pass-occurrence-to-emit-pattern</guid>
<pubDate>Thu, 20 Jun 2013 16:44:40 +0000</pubDate>
</item>
<item>
<title>complexity analysis</title>
<link>https://ask.clojure.org/index.php/7461/complexity-analysis</link>
<description>&lt;p&gt;For smaller matches avoid backtracking actually greatly improves performance at the potential cost of code size. Perhaps we can devise a heuristic such that we employ the the best option available? Would need some serious hammock time.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7461/complexity-analysis</guid>
<pubDate>Wed, 19 Jun 2013 04:22:13 +0000</pubDate>
</item>
<item>
<title>cata matching</title>
<link>https://ask.clojure.org/index.php/7450/cata-matching</link>
<description>&lt;p&gt;Dan Friedman's pattern matcher has a nice feature called cata-matching - allowing recursive matching from the match itself. Useful when writing compilers.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7450/cata-matching</guid>
<pubDate>Fri, 23 Nov 2012 22:54:30 +0000</pubDate>
</item>
<item>
<title>Improve match compile times</title>
<link>https://ask.clojure.org/index.php/7457/improve-match-compile-times</link>
<description></description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7457/improve-match-compile-times</guid>
<pubDate>Wed, 15 Aug 2012 19:04:32 +0000</pubDate>
</item>
<item>
<title>Duplicate wildcard detection in pattern row doesn't account for locals</title>
<link>https://ask.clojure.org/index.php/7459/duplicate-wildcard-detection-pattern-doesnt-account-locals</link>
<description></description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7459/duplicate-wildcard-detection-pattern-doesnt-account-locals</guid>
<pubDate>Thu, 12 Jan 2012 14:36:14 +0000</pubDate>
</item>
<item>
<title>Allow or'ing of guard functions</title>
<link>https://ask.clojure.org/index.php/7455/allow-oring-of-guard-functions</link>
<description>&lt;p&gt;In order to simplify composition of guard predicates which are alternatives, allow for passing a sequence of predicates whose values when called will be or'd together.&lt;/p&gt;
&lt;p&gt;The :when keyword currently allows passing of a vector of predicates that are and'd together.&lt;/p&gt;
&lt;p&gt;Either case (&lt;code&gt;and&lt;/code&gt; or &lt;code&gt;or&lt;/code&gt;) can be achieved externally to match via composition, and an alternative might be to force explicit composition outside of core.match.&lt;/p&gt;
&lt;p&gt;At the least, the documentation should mention that multiple predicates will be and'd together.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7455/allow-oring-of-guard-functions</guid>
<pubDate>Mon, 21 Nov 2011 17:11:42 +0000</pubDate>
</item>
<item>
<title>vector patterns should work on seq</title>
<link>https://ask.clojure.org/index.php/7481/vector-patterns-should-work-on-seq</link>
<description>&lt;p&gt;This means abandoning subvec and using nth + offsets.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7481/vector-patterns-should-work-on-seq</guid>
<pubDate>Tue, 11 Oct 2011 04:35:41 +0000</pubDate>
</item>
<item>
<title>Implement (p|q)ba heuristics</title>
<link>https://ask.clojure.org/index.php/7454/implement-p-q-ba-heuristics</link>
<description>&lt;p&gt;We should implement the rest of Maranget's suggested heuristics.&lt;/p&gt;
&lt;p&gt;p - needed prefix&lt;br&gt;
q - constructor prefix&lt;br&gt;
b - branching factor&lt;br&gt;
a - constructor arity&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7454/implement-p-q-ba-heuristics</guid>
<pubDate>Sun, 04 Sep 2011 16:00:57 +0000</pubDate>
</item>
<item>
<title>Eliminate distinction between leaf-bind-expr and bind-expr</title>
<link>https://ask.clojure.org/index.php/7452/eliminate-distinction-between-leaf-bind-expr-and-bind-expr</link>
<description>&lt;p&gt;We should have a better considered binding model that works for all cases instead of treating leaf nodes and regular binding as different cases.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7452/eliminate-distinction-between-leaf-bind-expr-and-bind-expr</guid>
<pubDate>Sun, 04 Sep 2011 16:00:02 +0000</pubDate>
</item>
<item>
<title>Optimized pattern matching on deftype/record, POJOs</title>
<link>https://ask.clojure.org/index.php/7471/optimized-pattern-matching-on-deftype-record-pojos</link>
<description>&lt;p&gt;&lt;code&gt;(match [x]
  [({:a 0 :b 1} :type Foo)] :a0
  ...)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;:a and :b would be converted to field access, i.e. (.a x)&lt;/p&gt;
&lt;p&gt;As with primitive array matching, we should do an instance check followed by hinted field access.&lt;/p&gt;
&lt;p&gt;We should consider adopting the deftype/record syntax.&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7471/optimized-pattern-matching-on-deftype-record-pojos</guid>
<pubDate>Sun, 04 Sep 2011 15:56:54 +0000</pubDate>
</item>
<item>
<title>Matching Diagnostics</title>
<link>https://ask.clojure.org/index.php/7458/matching-diagnostics</link>
<description>&lt;p&gt;Communicate to the user precisely what failed to match. Conversation here: &lt;a rel=&quot;nofollow&quot; href=&quot;http://groups.google.com/group/clojure/browse_thread/thread/675456fba1712214&quot;&gt;http://groups.google.com/group/clojure/browse_thread/thread/675456fba1712214&lt;/a&gt;. We adopt the behavior of condp since that is closer to what match does and will do (predicate dispatch)&lt;/p&gt;
</description>
<category>core.match</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7458/matching-diagnostics</guid>
<pubDate>Sun, 04 Sep 2011 15:54:33 +0000</pubDate>
</item>
</channel>
</rss>