<p dir="ltr">I like the function, but I'd like to bikeshed a bit. The name "restriction" seems confusing to me, or at least I don't understand the etymology. As of now I'd prefer something like "filterMember". filterMember is to (filter . flip member) as concatMap is to (concat . map). That's not perfectly consistent due to the flip, but I think it's close enough to motivate the name.</p>
<br><div class="gmail_quote"><div dir="ltr">On Thu, Jul 14, 2016, 5:39 AM Andreas Abel <<a href="mailto:abela@chalmers.se">abela@chalmers.se</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+1.<br>
<br>
On 14.07.2016 06:45, David Feuer wrote:<br>
> Cale Gibbard proposes the following:<br>
><br>
> Data.IntMap.restriction :: IntSet -> IntMap a -> IntMap a<br>
> Data.Map.restriction :: Ord k => Set k -> Map k a -> Map k a<br>
><br>
> In each case, the map is filtered to contain only the keys that are<br>
> also found in the set. This can be implemented efficiently using a<br>
> slightly stripped-down version of Data.Map.intersection.<br>
><br>
> David Feuer<br>
> _______________________________________________<br>
> Libraries mailing list<br>
> <a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
><br>
<br>
<br>
--<br>
Andreas Abel <>< Du bist der geliebte Mensch.<br>
<br>
Department of Computer Science and Engineering<br>
Chalmers and Gothenburg University, Sweden<br>
<br>
<a href="mailto:andreas.abel@gu.se" target="_blank">andreas.abel@gu.se</a><br>
<a href="http://www2.tcs.ifi.lmu.de/~abel/" rel="noreferrer" target="_blank">http://www2.tcs.ifi.lmu.de/~abel/</a><br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>