<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions and answers in data.priority-map</title>
<link>https://ask.clojure.org/index.php/qa/contrib-libs/data-priority-map</link>
<description></description>
<item>
<title>clojure.data.priority-map's IKVReduce implementation doesn’t support `reduced`</title>
<link>https://ask.clojure.org/index.php/14149/clojure-priority-ikvreduce-implementation-support-reduced</link>
<description>&lt;p&gt;Hi folks! &lt;/p&gt;
&lt;p&gt;Just a heads-up that clojure.data.priority-map’s IKVReduce implementation doesn’t support &lt;code&gt;reduced&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The current implementation (v1.2.0, 2024-02-19):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clojure.core.protocols/IKVReduce
(kv-reduce [this f init]
  (if keyfn            
    (reduce-kv (fn [a k v] (reduce (fn [a v] (f a v (item-&amp;gt;priority v))) a v))
      init priority-&amp;gt;set-of-items)
    (reduce-kv (fn [a k v] (reduce (fn [a v] (f a v k)) a v))
      init priority-&amp;gt;set-of-items)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But the nested reduce means that something like this’d be needed:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn- convey-reduced [x] (if (reduced? x) (reduced x) x))

clojure.core.protocols/IKVReduce
(kv-reduce [this f init]
  (if keyfn            
    (reduce-kv (fn [a k v] (reduce (fn [a v] (convey-reduced (f a v (item-&amp;gt;priority v))) a v)))
      init priority-&amp;gt;set-of-items)
    (reduce-kv (fn [a k v] (reduce (fn [a v] (convey-reduced (f a v k)) a v)))
      init priority-&amp;gt;set-of-items)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that the issue affects only &lt;code&gt;(reduce-kv a-priority-map …)&lt;/code&gt;, not &lt;code&gt;(reduce a-priority-map …)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Thanks, cheers! :-)&lt;/p&gt;
</description>
<category>data.priority-map</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14149/clojure-priority-ikvreduce-implementation-support-reduced</guid>
<pubDate>Sat, 28 Sep 2024 23:52:55 +0000</pubDate>
</item>
<item>
<title>Answered: Add more developer info and Markdown markup to README</title>
<link>https://ask.clojure.org/index.php/7080/add-more-developer-info-and-markdown-markup-to-readme?show=7083#a7083</link>
<description>Reference: &lt;a href=&quot;https://clojure.atlassian.net/browse/DPRIMAP-3&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;https://clojure.atlassian.net/browse/DPRIMAP-3&lt;/a&gt; (reported by jafingerhut)</description>
<category>data.priority-map</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7080/add-more-developer-info-and-markdown-markup-to-readme?show=7083#a7083</guid>
<pubDate>Wed, 26 Jun 2019 12:00:00 +0000</pubDate>
</item>
<item>
<title>Answered: Add clojurescript support</title>
<link>https://ask.clojure.org/index.php/7082/add-clojurescript-support?show=7087#a7087</link>
<description>Reference: &lt;a href=&quot;https://clojure.atlassian.net/browse/DPRIMAP-8&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;https://clojure.atlassian.net/browse/DPRIMAP-8&lt;/a&gt; (reported by desk@danielcompton.net)</description>
<category>data.priority-map</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7082/add-clojurescript-support?show=7087#a7087</guid>
<pubDate>Wed, 26 Jun 2019 12:00:00 +0000</pubDate>
</item>
<item>
<title>Answered: Add support for subseq, rsubseq</title>
<link>https://ask.clojure.org/index.php/7081/add-support-for-subseq-rsubseq?show=7085#a7085</link>
<description>Reference: &lt;a href=&quot;https://clojure.atlassian.net/browse/DPRIMAP-5&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;https://clojure.atlassian.net/browse/DPRIMAP-5&lt;/a&gt; (reported by jafingerhut)</description>
<category>data.priority-map</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7081/add-support-for-subseq-rsubseq?show=7085#a7085</guid>
<pubDate>Wed, 26 Jun 2019 12:00:00 +0000</pubDate>
</item>
</channel>
</rss>