https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112012-07-14T18:35:23ZRuby Issue Tracking SystemRuby master - Feature #6588: Set#intersect?https://redmine.ruby-lang.org/issues/6588?journal_id=280852012-07-14T18:35:23Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li></ul> Ruby master - Feature #6588: Set#intersect?https://redmine.ruby-lang.org/issues/6588?journal_id=315372012-10-25T19:44:48Zyhara (Yutaka HARA)
<ul><li><strong>Target version</strong> changed from <i>2.0.0</i> to <i>2.6</i></li></ul> Ruby master - Feature #6588: Set#intersect?https://redmine.ruby-lang.org/issues/6588?journal_id=328002012-11-12T13:12:59Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul></ul><p>Comment about these simple features would be appreciated.</p> Ruby master - Feature #6588: Set#intersect?https://redmine.ruby-lang.org/issues/6588?journal_id=328132012-11-12T18:08:16Zalexeymuranov (Alexey Muranov)
<ul></ul><p>+1. Maybe <code>#meet?</code> instead of <code>#intersect?</code> ? It can be argued that any set intersects any other, just the intersection is sometimes empty :).</p> Ruby master - Feature #6588: Set#intersect?https://redmine.ruby-lang.org/issues/6588?journal_id=328182012-11-13T00:38:29Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul></ul><p>alexeymuranov (Alexey Muranov) wrote:</p>
<blockquote>
<p>+1.</p>
</blockquote>
<p>Thanks for the +1</p>
<blockquote>
<p>It can be argued that any set intersects any other, just the intersection is sometimes empty :).</p>
</blockquote>
<p>No, I believe it would be wrong to argue that. From wikipedia: "We say that A intersects B if A intersects B at some element"</p>
<p>Moreover: "We say that A and B are disjoint if A does not intersect B. In plain language, they have no elements in common"</p>
<p>I believe that both <code>intersect?</code> and <code>disjoint?</code> are the established terms for the concept I'm proposing.</p> Ruby master - Feature #6588: Set#intersect?https://redmine.ruby-lang.org/issues/6588?journal_id=407052013-07-27T14:59:40Zknu (Akinori MUSHA)knu@ruby-lang.org
<ul></ul><p>OK, accepted. I'll work on it.</p> Ruby master - Feature #6588: Set#intersect?https://redmine.ruby-lang.org/issues/6588?journal_id=407582013-07-30T18:58:16Zknu (Akinori MUSHA)knu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r42253.<br>
Marc-Andre, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<p>Add Set#intersect? and #disjoint?.</p>
<ul>
<li>lib/set.rb (Set#intersect?, Set#disjoint?): Add new methods for<br>
testing if two sets have any element in common.<br>
<a href="/issues/6588">[ruby-core:45641]</a> [Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Set#intersect? (Closed)" href="https://redmine.ruby-lang.org/issues/6588">#6588</a>] Based on the code by marcandre.</li>
</ul> Ruby master - Feature #6588: Set#intersect?https://redmine.ruby-lang.org/issues/6588?journal_id=407592013-07-30T19:19:21Zknu (Akinori MUSHA)knu@ruby-lang.org
<ul></ul><p>I followed superset?() and the like, and made the new methods accept only a set for the moment, because I couldn't come up with an idea of how to deal with Range. For example:</p>
<ul>
<li>if Set[2].intersect?(1.5..2.5) should return true</li>
<li>if Set[2].intersect?(3..(1.0/0)) should immediately return false using some knowledge on Range</li>
</ul>