<div dir="ltr"><div style>Branches: 13.05, master</div><div><br></div><div>------------------------------</div><div><br></div><div>Add the function bimap.count/1.</div><div><br></div><div>library/bimap.m:</div><div><span class="" style="white-space:pre">    </span>Add the above function.</div>
<div><br></div><div><span class="" style="white-space:pre">   </span>Fix the wording of a function description.</div><div><br></div><div>NEWS:</div><div><span class="" style="white-space:pre">    </span>Add a section for 13.05.1 and mention the above change in it.</div>
<div><br></div><div>Julien.</div><div><br></div><div>diff --git a/NEWS b/NEWS</div><div>index 19e9548..b3bc8c5 100644</div><div>--- a/NEWS</div><div>+++ b/NEWS</div><div>@@ -1,3 +1,11 @@</div><div>+NEWS for Mercury 13.05.1</div>
<div>+------------------------</div><div>+</div><div>+Changes to the Mercury standard library:</div><div>+</div><div>+* We have added the function bimap.count/1.</div><div>+</div><div>+</div><div> NEWS for Mercury 13.05</div>
<div> ----------------------</div><div> </div><div>diff --git a/library/bimap.m b/library/bimap.m</div><div>index 7110213..4fd8a5b 100644</div><div>--- a/library/bimap.m</div><div>+++ b/library/bimap.m</div><div>@@ -203,6 +203,10 @@</div>
<div> :- pred bimap.overlay(bimap(K, V)::in, bimap(K, V)::in, bimap(K, V)::out)</div><div>     is det.</div><div> </div><div>+    % Count the number of key-value pairs in the bimap.</div><div>+    %</div><div>+:- func bimap.count(bimap(K, V)) = int.</div>
<div>+</div><div>     % Convert a bimap to an association list.</div><div>     %</div><div> :- func bimap.to_assoc_list(bimap(K, V)) = assoc_list(K, V).</div><div>@@ -217,7 +221,7 @@</div><div>     is semidet.</div><div> </div>
<div>     % As above but throws an exception instead of failing if the</div><div>-    % association list does not implicitly defined a bijection.</div><div>+    % association list does not implicitly define a bijection.</div>
<div>     %</div><div> :- func bimap.det_from_assoc_list(assoc_list(K, V)) = bimap(K, V).</div><div> :- pred bimap.det_from_assoc_list(assoc_list(K, V)::in, bimap(K, V)::out)</div><div>@@ -563,6 +567,10 @@ bimap.overlay_2([Key - Value | KeysValues], !BM) :-</div>
<div>     bimap.set(Key, Value, !BM),</div><div>     bimap.overlay_2(KeysValues, !BM).</div><div> </div><div>+bimap.count(BM) = Count :-</div><div>+    BM = bimap(Forward, _),</div><div>+    Count = map.count(Forward).</div>
<div>+</div><div> bimap.to_assoc_list(BM) = AL :-</div><div>     bimap.to_assoc_list(BM, AL).</div><div> </div><div><br></div></div>